Skip to content

Commit

Permalink
Do not export symbols when building static libs
Browse files Browse the repository at this point in the history
Closes #101
  • Loading branch information
costashatz authored and gergondet committed Aug 1, 2023
1 parent fbfb960 commit 22c5dde
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/RBDyn/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,11 @@ target_include_directories(
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/../include>
$<INSTALL_INTERFACE:include>)
target_link_libraries(RBDyn PUBLIC SpaceVecAlg::SpaceVecAlg)
set_target_properties(RBDyn PROPERTIES COMPILE_FLAGS "-Drbdyn_EXPORTS")
if(BUILD_SHARED_LIBS)
set_target_properties(RBDyn PROPERTIES COMPILE_FLAGS "-Drbdyn_EXPORTS")
else()
target_compile_definitions(RBDyn PUBLIC "-DRBDYN_STATIC")
endif()
set_target_properties(RBDyn PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR}
VERSION ${PROJECT_VERSION})
set_target_properties(RBDyn PROPERTIES CXX_STANDARD 11)
Expand Down
8 changes: 6 additions & 2 deletions src/parsers/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,12 @@ target_include_directories(
$<INSTALL_INTERFACE:include>)
target_link_libraries(RBDynParsers PUBLIC RBDyn tinyxml2::tinyxml2 yaml-cpp
Boost::boost)
set_target_properties(RBDynParsers PROPERTIES COMPILE_FLAGS
"-DRBDYN_PARSERS_EXPORTS")
if(BUILD_SHARED_LIBS)
set_target_properties(RBDynParsers PROPERTIES COMPILE_FLAGS
"-DRBDYN_PARSERS_EXPORTS")
else()
target_compile_definitions(RBDynParsers PUBLIC "-DRBDYN_PARSERS_STATIC")
endif()
set_target_properties(RBDynParsers PROPERTIES CXX_STANDARD 11)
set_target_properties(RBDynParsers PROPERTIES EXPORT_NAME Parsers)
set_target_properties(RBDynParsers PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR}
Expand Down

0 comments on commit 22c5dde

Please sign in to comment.