Added a flag to optionally remove examples from "all" target
parent
ba6439dbb1
commit
720ff3ac82
|
@ -84,6 +84,7 @@ endif(GTSAM_USE_QUATERNIONS)
|
||||||
# Alternative version to keep tests from building during make install
|
# Alternative version to keep tests from building during make install
|
||||||
# Use the EXCLUDE_FROM_ALL property on test executables
|
# Use the EXCLUDE_FROM_ALL property on test executables
|
||||||
option(GTSAM_ENABLE_INSTALL_TEST_FIX "Enable/Disable fix to remove dependency of tests on 'all' target" ON)
|
option(GTSAM_ENABLE_INSTALL_TEST_FIX "Enable/Disable fix to remove dependency of tests on 'all' target" ON)
|
||||||
|
option(GTSAM_ENABLE_INSTALL_EXAMPLE_FIX "Enable/Disable fix to remove dependency of examples on 'all' target" OFF)
|
||||||
|
|
||||||
# Pull in infrastructure
|
# Pull in infrastructure
|
||||||
if (GTSAM_BUILD_TESTS)
|
if (GTSAM_BUILD_TESTS)
|
||||||
|
@ -162,6 +163,7 @@ if(GTSAM_UNSTABLE_AVAILABLE)
|
||||||
print_config_flag(${GTSAM_BUILD_UNSTABLE} "Build libgtsam_unstable ")
|
print_config_flag(${GTSAM_BUILD_UNSTABLE} "Build libgtsam_unstable ")
|
||||||
endif()
|
endif()
|
||||||
print_config_flag(${GTSAM_ENABLE_INSTALL_TEST_FIX} "Tests excluded from all target ")
|
print_config_flag(${GTSAM_ENABLE_INSTALL_TEST_FIX} "Tests excluded from all target ")
|
||||||
|
print_config_flag(${GTSAM_ENABLE_INSTALL_EXAMPLE_FIX} "Examples excluded from all target ")
|
||||||
string(TOUPPER "${CMAKE_BUILD_TYPE}" cmake_build_type_toupper)
|
string(TOUPPER "${CMAKE_BUILD_TYPE}" cmake_build_type_toupper)
|
||||||
message(STATUS " Build type : ${CMAKE_BUILD_TYPE}")
|
message(STATUS " Build type : ${CMAKE_BUILD_TYPE}")
|
||||||
message(STATUS " C compilation flags : ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${cmake_build_type_toupper}}")
|
message(STATUS " C compilation flags : ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${cmake_build_type_toupper}}")
|
||||||
|
|
|
@ -8,6 +8,12 @@ foreach(example_src ${example_srcs} )
|
||||||
message(STATUS "Adding Example ${example_bin}")
|
message(STATUS "Adding Example ${example_bin}")
|
||||||
add_dependencies(examples ${example_bin})
|
add_dependencies(examples ${example_bin})
|
||||||
add_executable(${example_bin} ${example_src})
|
add_executable(${example_bin} ${example_src})
|
||||||
|
|
||||||
|
# Disable building during make all/install
|
||||||
|
if (GTSAM_ENABLE_INSTALL_EXAMPLE_FIX)
|
||||||
|
set_target_properties(${example_bin} PROPERTIES EXCLUDE_FROM_ALL ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
target_link_libraries(${example_bin} gtsam-static)
|
target_link_libraries(${example_bin} gtsam-static)
|
||||||
add_custom_target(${example_bin}.run ${EXECUTABLE_OUTPUT_PATH}${example_bin} ${ARGN})
|
add_custom_target(${example_bin}.run ${EXECUTABLE_OUTPUT_PATH}${example_bin} ${ARGN})
|
||||||
endforeach(example_src)
|
endforeach(example_src)
|
||||||
|
|
|
@ -25,6 +25,14 @@ gtsam_add_subdir_tests(discrete_unstable "${discrete_local_libs}" "${discrete_fu
|
||||||
# add examples
|
# add examples
|
||||||
foreach(example schedulingExample schedulingQuals12)
|
foreach(example schedulingExample schedulingQuals12)
|
||||||
add_executable(${example} "examples/${example}.cpp")
|
add_executable(${example} "examples/${example}.cpp")
|
||||||
|
|
||||||
|
# Disable building during make all/install
|
||||||
|
if (GTSAM_ENABLE_INSTALL_EXAMPLE_FIX)
|
||||||
|
set_target_properties(${example} PROPERTIES EXCLUDE_FROM_ALL ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_dependencies(examples ${example})
|
||||||
|
|
||||||
add_dependencies(${example} gtsam-static gtsam_unstable-static)
|
add_dependencies(${example} gtsam-static gtsam_unstable-static)
|
||||||
target_link_libraries(${example} gtsam-static gtsam_unstable-static)
|
target_link_libraries(${example} gtsam-static gtsam_unstable-static)
|
||||||
add_custom_target(${example}.run ${EXECUTABLE_OUTPUT_PATH}${example} ${ARGN})
|
add_custom_target(${example}.run ${EXECUTABLE_OUTPUT_PATH}${example} ${ARGN})
|
||||||
|
|
Loading…
Reference in New Issue