diff --git a/cmake/functions.cmake b/cmake/functions.cmake index 3f5dd82..4723c11 100644 --- a/cmake/functions.cmake +++ b/cmake/functions.cmake @@ -30,7 +30,6 @@ macro(_parse_arguments ARGS) list(APPEND OPTIONS USES_CARTOGRAPHER USES_PCL - USES_ROS USES_YAMLCPP ) set(ONE_VALUE_ARG ) @@ -42,6 +41,14 @@ endmacro(_parse_arguments) macro(_common_compile_stuff VISIBILITY) set(TARGET_COMPILE_FLAGS "${TARGET_COMPILE_FLAGS} ${GOOG_CXX_FLAGS}") + if(catkin_INCLUDE_DIRS) + target_include_directories("${NAME}" SYSTEM ${VISIBILITY} + "${catkin_INCLUDE_DIRS}") + target_link_libraries("${NAME}" ${catkin_LIBRARIES}) + add_dependencies("${NAME}" ${catkin_EXPORTED_TARGETS} + ) + endif() + if(ARG_USES_EIGEN) target_include_directories("${NAME}" SYSTEM ${VISIBILITY} "${EIGEN3_INCLUDE_DIR}") @@ -79,14 +86,6 @@ macro(_common_compile_stuff VISIBILITY) target_link_libraries("${NAME}" gflags) endif() - if(ARG_USES_ROS) - target_include_directories("${NAME}" SYSTEM ${VISIBILITY} - "${catkin_INCLUDE_DIRS}") - target_link_libraries("${NAME}" ${catkin_LIBRARIES}) - add_dependencies("${NAME}" ${catkin_EXPORTED_TARGETS} - ) - endif() - if(ARG_USES_CARTOGRAPHER) target_include_directories("${NAME}" SYSTEM ${VISIBILITY} "${CARTOGRAPHER_INCLUDE_DIRS}") @@ -222,7 +221,7 @@ macro(_common_test_stuff) target_link_libraries("${NAME}" ${GMOCK_LIBRARIES}) endmacro() -function(google_catkin_test NAME) +function(_google_catkin_test NAME) if(NOT "${CATKIN_ENABLE_TESTING}") return() endif() @@ -241,6 +240,10 @@ function(google_catkin_test NAME) endfunction() function(google_test NAME) + if (catkin_INCLUDE_DIRS) + _google_catkin_test(${ARGV}) + return() + endif() _parse_arguments("${ARGN}") _common_test_stuff() add_test(${NAME} ${NAME}) diff --git a/scripts/update_cmakelists.py b/scripts/update_cmakelists.py index 9fd3f83..b6d0d12 100755 --- a/scripts/update_cmakelists.py +++ b/scripts/update_cmakelists.py @@ -107,10 +107,6 @@ def ExtractUses(project_name, source): uses.add("USES_WEBP") if re.match(r'^#include ["<]pcl/', line): uses.add("USES_PCL") - if re.match(r'^#include ["<]ros/', line): - uses.add("USES_ROS") - if re.match(r'^#include "[a-zA-Z]*_msgs/', line): - uses.add("USES_ROS") if re.match(r'^#include ["<]yaml-cpp/', line): uses.add("USES_YAMLCPP") if re.match(r'^#include ["<]cairo/', line): @@ -248,8 +244,6 @@ def RunOnDirectory(root): continue target.depends.add(dependant.name) target.uses.update(ExtractUses(project_name, src)) - if target.type is "google_test" and "USES_ROS" in target.uses: - target.type = "google_catkin_test" cmake_file = path.join(directory, "CMakeLists.txt") parts = GetNonGoogleTargetLines(cmake_file)