Skip to content

Commit

Permalink
updated cmake min version to 2.8.3, use cmake_parse_arguments instead…
Browse files Browse the repository at this point in the history
… of custom macro
  • Loading branch information
dirk-thomas committed Oct 3, 2012
1 parent bfd334d commit c398a2a
Show file tree
Hide file tree
Showing 23 changed files with 38 additions and 26 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 2.8.3)

set(catkin_EXTRAS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/cmake)

Expand Down
3 changes: 3 additions & 0 deletions cmake/all.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ if(NOT PROJECT_NAME)
project(catkin_internal)
endif()

# include CMake functions
include(CMakeParseArguments)

# functions/macros: list_append_unique, safe_execute_process
# python-integration: catkin_python_setup.cmake, interrogate_setup_dot_py.py, templates/__init__.py.in, templates/script.py.in, templates/python_distutils_install.bat.in, templates/python_distutils_install.sh.in, templates/safe_execute_install.cmake.in
foreach(filename
Expand Down
2 changes: 1 addition & 1 deletion cmake/catkin_add_env_hooks.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
# @public
#
function(catkin_add_env_hooks file_prefix)
parse_arguments(ARG "DIRECTORY;SHELLS" "SKIP_INSTALL" ${ARGN})
cmake_parse_arguments(ARG "SKIP_INSTALL" "DIRECTORY" "SHELLS" ${ARGN})

# create directory if necessary
if(NOT IS_DIRECTORY ${CATKIN_BUILD_PREFIX}/etc/catkin/profile.d)
Expand Down
6 changes: 3 additions & 3 deletions cmake/catkin_package_xml.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ macro(catkin_package_xml)
message(FATAL_ERROR "catkin_package_xml() PROJECT_NAME is not set. You must call project() before you can call catkin_package_xml().")
endif()

parse_arguments(_PACKAGE_XML "DIRECTORY" "" ${ARGN})
if(_PACKAGE_XML_DEFAULT_ARGS)
message(FATAL_ERROR "catkin_package_xml() called with unused arguments: ${_PACKAGE_XML_DEFAULT_ARGS}")
cmake_parse_arguments(_PACKAGE_XML "" "DIRECTORY" "" ${ARGN})
if(_PACKAGE_XML_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "catkin_package_xml() called with unused arguments: ${_PACKAGE_XML_UNPARSED_ARGUMENTS}")
endif()
# set default directory
if(NOT _PACKAGE_XML_DIRECTORY)
Expand Down
2 changes: 1 addition & 1 deletion cmake/find_program_required.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function(find_program_required ARG_VAR ARG_PROGRAM_NAME)
parse_arguments(ARG "PATHS" "NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH" ${ARGN})
cmake_parse_arguments(ARG "NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH" "" "PATHS" ${ARGN})
find_program(${ARG_VAR} ${ARG_PROGRAM_NAME} PATHS ${ARG_PATHS} ${ARG_NO_DEFAULT_PATH} ${ARG_NO_CMAKE_FIND_ROOT_PATH})
if(NOT ${ARG_VAR})
message(FATAL_ERROR "${ARG_PROGRAM_NAME} not found")
Expand Down
9 changes: 9 additions & 0 deletions cmake/parse_arguments.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,16 @@
# parse_arguments() taken from
# http://www.itk.org/Wiki/CMakeMacroParseArguments
#
# @deprecated use CMakeParseArguments instead
#
macro(parse_arguments prefix arg_names option_names)
message(WARNING "parse_arguments(prefix args options ${ARGN}) is deprecated. Use the corresponding CMake function instead:")
message(" call 'include(CMakeParseArguments)' to include the CMake function")
message(" Update the signature:")
message(" instead of 'parse_arguments(prefix option_names arg_names ${ARGN})'")
message(" it is 'cmake_parse_arguments(prefix option_names single_arg_names multi_arg_names ${ARGN}))")
message(" and the variable containing not matched arguments must be changed form 'prefix_DEFAULT_ARGS' to 'prefix_UNPARSED_ARGUMENTS'")

set(DEFAULT_ARGS)
foreach(arg_name ${arg_names})
set(${prefix}_${arg_name})
Expand Down
4 changes: 2 additions & 2 deletions cmake/test/gtest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ function(catkin_add_gtest target)
endif()

# XXX look for optional TIMEOUT argument, #2645
parse_arguments(_gtest "TIMEOUT;WORKING_DIRECTORY" "" ${ARGN})
cmake_parse_arguments(_gtest "" "TIMEOUT;WORKING_DIRECTORY" "" ${ARGN})
if(_gtest_TIMEOUT)
message(WARNING "TIMEOUT argument to catkin_add_gtest() is ignored")
endif()

# create the executable, with basic + gtest build flags
include_directories(${GTEST_INCLUDE_DIRS})
link_directories(${GTEST_LIBRARY_DIRS})
add_executable(${target} EXCLUDE_FROM_ALL ${_gtest_DEFAULT_ARGS})
add_executable(${target} EXCLUDE_FROM_ALL ${_gtest_UNPARSED_ARGUMENTS})
assert(GTEST_LIBRARIES)
target_link_libraries(${target} ${GTEST_LIBRARIES} ${THREADS_LIBRARY})

Expand Down
2 changes: 1 addition & 1 deletion cmake/test/nosetests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function(catkin_add_nosetests path)
return()
endif()

parse_arguments(_nose "DEPENDENCIES;TIMEOUT;WORKING_DIRECTORY" "" ${ARGN})
cmake_parse_arguments(_nose "" "TIMEOUT;WORKING_DIRECTORY" "DEPENDENCIES" ${ARGN})
if(NOT _nose_TIMEOUT)
set(_nose_TIMEOUT 60)
endif()
Expand Down
6 changes: 3 additions & 3 deletions cmake/test/tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ endif()
# catkin_add_*test() functions.
#
function(catkin_run_tests_target type name xunit_filename)
parse_arguments(_testing "COMMAND;DEPENDENCIES;WORKING_DIRECTORY" "" ${ARGN})
if(_testing_DEFAULT_ARGS)
message(FATAL_ERROR "catkin_run_tests_target() called with unused arguments: ${_testing_DEFAULT_ARGS}")
cmake_parse_arguments(_testing "" "WORKING_DIRECTORY" "COMMAND;DEPENDENCIES" ${ARGN})
if(_testing_UNPARSED_ARGUMENTS)
message(FATAL_ERROR "catkin_run_tests_target() called with unused arguments: ${_testing_UNPARSED_ARGUMENTS}")
endif()

# create meta target to trigger all tests of a project
Expand Down
2 changes: 1 addition & 1 deletion cmake/toplevel.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# toplevel CMakeLists.txt for a catkin workspace
# catkin/cmake/toplevel.cmake

cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 2.8.3)

# optionally provide a cmake file in the workspace to override arbitrary stuff
include(workspace.cmake OPTIONAL)
Expand Down
2 changes: 1 addition & 1 deletion doc/user_guide/catkin_migration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ file::

The contents of the /stick/stick/CMakeLists.txt file should look like this::

cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 2.8.3)
project(stick)
find_package(catkin REQUIRED)
catkin_package()
Expand Down
2 changes: 1 addition & 1 deletion doc/user_guide/standards.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ frequent errors, follow the standards below.
The following line should always appear like this in this order
without other commands in between::

cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 2.8.3)
project(myproject)
find_package(catkin REQUIRED <COMPONENTS ...>)
catkin_project(${PROJECT_NAME} <...>)
Expand Down
2 changes: 1 addition & 1 deletion doc/user_guide/supposed.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ CMakeLists.txt

The basic case::

cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 2.8.3)
project(pkgname)

find_package(catkin REQUIRED [COMPONENTS otherpkg ...])
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 2.8.3)

project(badly_specified_changelog)
find_package(catkin)
Expand Down
2 changes: 1 addition & 1 deletion test/mock_resources/src-fail/noproject/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 2.8.3)
# commented to cause failure
# project(noproject)
find_package(catkin)
Expand Down
2 changes: 1 addition & 1 deletion test/mock_resources/src/catkin_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 2.8.3)
project(catkin_test)
find_package(catkin REQUIRED)

Expand Down
2 changes: 1 addition & 1 deletion test/mock_resources/src/catkin_test/a/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 2.8.3)
project(a)
find_package(catkin REQUIRED COMPONENTS genmsg std_msgs)

Expand Down
2 changes: 1 addition & 1 deletion test/mock_resources/src/catkin_test/b/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 2.8.3)
project(b)
find_package(catkin REQUIRED)
catkin_package(
Expand Down
2 changes: 1 addition & 1 deletion test/mock_resources/src/catkin_test/c/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 2.8.3)
project(c)
find_package(catkin REQUIRED)

Expand Down
2 changes: 1 addition & 1 deletion test/mock_resources/src/catkin_test/d/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 2.8.3)
project(d)
find_package(catkin REQUIRED)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 2.8.3)
project(quux_msgs)
find_package(catkin REQUIRED)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 2.8.3)
project(quux_user)
find_package(catkin REQUIRED)

Expand Down
2 changes: 1 addition & 1 deletion test/mock_resources/src/nolangs/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 2.8)
cmake_minimum_required(VERSION 2.8.3)

project(nolangs)
find_package(catkin REQUIRED)
Expand Down

0 comments on commit c398a2a

Please sign in to comment.