diff --git a/cmake/example_project/CMakeLists.txt b/cmake/example_project/CMakeLists.txt index 2afc6edc2..620ad4811 100644 --- a/cmake/example_project/CMakeLists.txt +++ b/cmake/example_project/CMakeLists.txt @@ -30,9 +30,12 @@ find_package(GTSAM REQUIRED) # Uses installed package ################################################################################### # Build static library from common sources set(CONVENIENCE_LIB_NAME ${PROJECT_NAME}) -add_library(${CONVENIENCE_LIB_NAME} STATIC example/PrintExamples.h example/PrintExamples.cpp) +add_library(${CONVENIENCE_LIB_NAME} SHARED example/PrintExamples.h example/PrintExamples.cpp) target_link_libraries(${CONVENIENCE_LIB_NAME} gtsam) +# Install library +install(TARGETS ${CONVENIENCE_LIB_NAME} LIBRARY DESTINATION lib ARCHIVE DESTINATION lib RUNTIME DESTINATION bin) + ################################################################################### # Build tests (CMake tracks the dependecy to link with GTSAM through our project's static library) gtsamAddTestsGlob("example" "tests/test*.cpp" "" "${CONVENIENCE_LIB_NAME}")