Updated CMakeLists to use newer cmake scripts

release/4.3a0
Alex Cunningham 2012-03-29 18:57:31 +00:00
parent 5e7c28f6a7
commit b67707542d
2 changed files with 27 additions and 40 deletions

View File

@ -1,16 +1,11 @@
if (GTSAM_BUILD_CONVENIENCE_LIBRARIES) set(tests_local_libs
set(convenience_libs slam
slam nonlinear
nonlinear linear
linear inference
inference geometry
geometry base
base ccolamd)
ccolamd)
else (GTSAM_BUILD_CONVENIENCE_LIBRARIES)
set(convenience_libs
gtsam-static)
endif (GTSAM_BUILD_CONVENIENCE_LIBRARIES)
# exclude certain files # exclude certain files
# note the source dir on each # note the source dir on each
@ -20,35 +15,26 @@ set (tests_exclude
# Build tests # Build tests
if (GTSAM_BUILD_TESTS) if (GTSAM_BUILD_TESTS)
# Subdirectory target for tests
add_custom_target(check.tests COMMAND ${CMAKE_CTEST_COMMAND}) add_custom_target(check.tests COMMAND ${CMAKE_CTEST_COMMAND})
file(GLOB tests_srcs "test*.cpp") set(is_test TRUE)
list(REMOVE_ITEM tests_srcs ${tests_exclude})
foreach(test_src ${tests_srcs}) # Build grouped tests
get_filename_component(test_base ${test_src} NAME_WE) gtsam_add_grouped_scripts("tests" # Use subdirectory as group label
set( test_bin ${test_base} ) "test*.cpp" check "Test" # Standard for all tests
message(STATUS "Adding Test ${test_bin}") "${tests_local_libs}" "gtsam-static" "${tests_exclude}" # Pass in linking and exclusion lists
add_executable(${test_bin} ${test_src}) ${is_test}) # Set all as tests
add_dependencies(check.tests ${test_bin})
add_dependencies(check ${test_bin})
add_test(${test_base} ${EXECUTABLE_OUTPUT_PATH}${test_bin})
target_link_libraries(${test_bin} ${convenience_libs} CppUnitLite ${Boost_LIBRARIES})
add_custom_target(${test_bin}.run ${EXECUTABLE_OUTPUT_PATH}${test_bin} ${ARGN})
endforeach(test_src)
endif (GTSAM_BUILD_TESTS) endif (GTSAM_BUILD_TESTS)
# Build timing scripts # Build timing scripts
if (GTSAM_BUILD_TIMING) if (GTSAM_BUILD_TIMING)
# Subdirectory target for timing - does not actually execute the scripts
add_custom_target(timing.tests) add_custom_target(timing.tests)
file(GLOB timing_srcs "time*.cpp") set(is_test FALSE)
list(REMOVE_ITEM timing_srcs ${tests_exclude})
foreach(time_src ${timing_srcs}) # Build grouped benchmarks
get_filename_component(time_base ${time_src} NAME_WE) gtsam_add_grouped_scripts("tests" # Use subdirectory as group label
set( time_bin ${time_base} ) "time*.cpp" timing "Timing Benchmark" # Standard for all timing scripts
message(STATUS "Adding Timing Benchmark ${time_bin}") "${tests_local_libs}" "gtsam-static" "${tests_exclude}" # Pass in linking and exclusion lists
add_executable(${time_bin} ${time_src}) ${is_test})
add_dependencies(timing.tests ${time_bin})
add_dependencies(timing ${time_bin})
target_link_libraries(${time_bin} ${convenience_libs} CppUnitLite ${Boost_LIBRARIES})
add_custom_target(${time_bin}.run ${EXECUTABLE_OUTPUT_PATH}${time_bin} ${ARGN})
endforeach(time_src)
endif (GTSAM_BUILD_TIMING) endif (GTSAM_BUILD_TIMING)

View File

@ -18,7 +18,8 @@ install(FILES matlab.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include/wrap)
# Build tests # Build tests
if (GTSAM_BUILD_TESTS) if (GTSAM_BUILD_TESTS)
add_definitions(-DTOPSRCDIR="${CMAKE_SOURCE_DIR}") add_definitions(-DTOPSRCDIR="${CMAKE_SOURCE_DIR}")
gtsam_add_external_tests(wrap wrap_lib) set(wrap_local_libs wrap_lib)
gtsam_add_subdir_tests("wrap" "${wrap_local_libs}" "${wrap_local_libs}" "")
endif(GTSAM_BUILD_TESTS) endif(GTSAM_BUILD_TESTS)
# Wrap codegen # Wrap codegen