Skip to content

Commit

Permalink
allow flexible CMake minimum version in metapackage CMake code (#1065)
Browse files Browse the repository at this point in the history
  • Loading branch information
dirk-thomas committed Feb 11, 2020
1 parent ebaa3c5 commit 38378ed
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion cmake/catkin_workspace.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,13 @@ function(catkin_workspace)
if(EXISTS ${CMAKE_SOURCE_DIR}/${path}/CMakeLists.txt)
# compare CMakeLists.txt with standard content
file(STRINGS ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/metapackages/${name}/CMakeLists.txt generated_cmakelists)
# allow any of CMake minimum version
string(REPLACE "2.8.3" "[0-9]+\\.[0-9]+\\.[0-9]+" generated_cmakelists_pattern "${generated_cmakelists}")
# need to escape parenthesis
string(REPLACE "(" "\\(" generated_cmakelists_pattern "${generated_cmakelists_pattern}")
string(REPLACE ")" "\\)" generated_cmakelists_pattern "${generated_cmakelists_pattern}")
file(STRINGS ${path}/CMakeLists.txt existing_cmakelists)
if(NOT "${generated_cmakelists}" STREQUAL "${existing_cmakelists}")
if(NOT "${existing_cmakelists}" MATCHES "${generated_cmakelists_pattern}")
set(CATKIN_NONHOMOGENEOUS_WORKSPACE TRUE)
message("WARNING: The CMakeLists.txt of the metapackage '${name}' contains non standard content. Use the content of the following file instead: ${CMAKE_CURRENT_BINARY_DIR}/catkin_generated/metapackages/${name}/CMakeLists.txt")
endif()
Expand Down

0 comments on commit 38378ed

Please sign in to comment.