diff --git a/cmake/IgnUtils.cmake b/cmake/IgnUtils.cmake index ef2cebf8..04ef252b 100644 --- a/cmake/IgnUtils.cmake +++ b/cmake/IgnUtils.cmake @@ -516,15 +516,24 @@ macro(_gz_list_to_string _output _input_list) endmacro() ################################################# -# ign_get_sources_and_unittests( ) +# gz_get_libsources_and_unittests( ) # # Grab all the files ending in "*.cc" from either the "src/" subdirectory or the # current subdirectory if "src/" does not exist. They will be collated into # library source files and unittest source files . # # These output variables can be consumed directly by ign_create_core_library(~), -# ign_add_component(~), ign_build_tests(~), and ign_build_executables(~). +# ign_add_component(~), gz_build_tests(~), and ign_build_executables(~). function(ign_get_libsources_and_unittests lib_sources_var tests_var) + # TODO(chapulina) Enable warnings after all libraries have migrated. + # message(WARNING "ign_get_libsources_and_unittests is deprecated, use gz_get_libsources_and_unittests instead.") + + gz_get_libsources_and_unittests(${lib_sources_var} ${tests_var}) + + set(${lib_sources_var} ${${lib_sources_var}} PARENT_SCOPE) + set(${tests_var} ${${tests_var}} PARENT_SCOPE) +endfunction() +function(gz_get_libsources_and_unittests lib_sources_var tests_var) # Glob all the source files if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/src) @@ -571,12 +580,20 @@ function(ign_get_libsources_and_unittests lib_sources_var tests_var) endfunction() ################################################# -# ign_get_sources() +# gz_get_sources() # # From the current directory, grab all the source files and place them into # . Remove their paths to make them suitable for passing into # ign_add_[library/tests]. function(ign_get_sources sources_var) + # TODO(chapulina) Enable warnings after all libraries have migrated. + # message(WARNING "ign_get_sources is deprecated, use gz_get_sources instead.") + + gz_get_sources(${sources_var}) + + set(${sources_var} ${${sources_var}} PARENT_SCOPE) +endfunction() +function(gz_get_sources sources_var) # GLOB all the source files file(GLOB source_files "*.cc") @@ -599,7 +616,7 @@ function(ign_get_sources sources_var) endfunction() ################################################# -# ign_install_all_headers( +# gz_install_all_headers( # [EXCLUDE_FILES ] # [EXCLUDE_DIRS ] # [GENERATED_HEADERS ] @@ -625,17 +642,31 @@ endfunction() # config.hh file since it would be redundant with the core library. # function(ign_install_all_headers) + # TODO(chapulina) Enable warnings after all libraries have migrated. + # message(WARNING "ign_install_all_headers is deprecated, use gz_install_all_headers instead.") - #------------------------------------ - # Define the expected arguments set(options) - set(oneValueArgs COMPONENT) # We are not using oneValueArgs yet + set(oneValueArgs COMPONENT) set(multiValueArgs EXCLUDE_FILES EXCLUDE_DIRS GENERATED_HEADERS) - - #------------------------------------ - # Parse the arguments _gz_cmake_parse_arguments(gz_install_all_headers "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + set(gz_install_all_headers_skip_parsing true) + gz_install_all_headers() +endfunction() +function(gz_install_all_headers) + + # Deprecated, remove skip parsing logic in version 4 + if (NOT gz_install_all_headers_skip_parsing) + #------------------------------------ + # Define the expected arguments + set(options) + set(oneValueArgs COMPONENT) + set(multiValueArgs EXCLUDE_FILES EXCLUDE_DIRS GENERATED_HEADERS) + + #------------------------------------ + # Parse the arguments + _gz_cmake_parse_arguments(gz_install_all_headers "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + endif() #------------------------------------ # Build the list of directories @@ -1597,7 +1628,7 @@ macro(ign_build_executables) endmacro() ################################################# -# ign_build_tests(TYPE +# gz_build_tests(TYPE # SOURCES # [LIB_DEPS ] # [INCLUDE_DIRS ] @@ -1627,33 +1658,47 @@ endmacro() # into your executable's directory. # macro(ign_build_tests) + # TODO(chapulina) Enable warnings after all libraries have migrated. + # message(WARNING "ign_build_tests is deprecated, use gz_build_tests instead.") - #------------------------------------ - # Define the expected arguments set(options SOURCE EXCLUDE_PROJECT_LIB) # NOTE: DO NOT USE "SOURCE", we're adding it here to catch typos set(oneValueArgs TYPE TEST_LIST) set(multiValueArgs SOURCES LIB_DEPS INCLUDE_DIRS) + _gz_cmake_parse_arguments(gz_build_tests "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + + set(gz_build_tests_skip_parsing true) + gz_build_tests(${PACKAGE_NAME}) +endmacro() +macro(gz_build_tests) + # Deprecated, remove skip parsing logic in version 4 + if (NOT gz_build_tests_skip_parsing) + #------------------------------------ + # Define the expected arguments + set(options SOURCE EXCLUDE_PROJECT_LIB) # NOTE: DO NOT USE "SOURCE", we're adding it here to catch typos + set(oneValueArgs TYPE TEST_LIST) + set(multiValueArgs SOURCES LIB_DEPS INCLUDE_DIRS) - #------------------------------------ - # Parse the arguments - _gz_cmake_parse_arguments(gz_build_tests "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + #------------------------------------ + # Parse the arguments + _gz_cmake_parse_arguments(gz_build_tests "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + endif() if(NOT gz_build_tests_TYPE) # If you have encountered this error, you are probably migrating to the # new ignition-cmake system. Be sure to also provide a SOURCES argument - # when calling ign_build_tests. + # when calling gz_build_tests. message(FATAL_ERROR "Developer error: You must specify a TYPE for your tests!") endif() if(gz_build_tests_SOURCE) # We have encountered cases where someone accidentally passes a SOURCE - # argument instead of a SOURCES argument into ign_build_tests, and the macro + # argument instead of a SOURCES argument into gz_build_tests, and the macro # didn't report any problem with it. Adding this warning should make it more # clear when that particular typo occurs. message(AUTHOR_WARNING - "Your script has specified SOURCE for ign_build_tests, which is not an " + "Your script has specified SOURCE for gz_build_tests, which is not an " "option. Did you mean to specify SOURCES (note the plural)?") endif() diff --git a/examples/comp_deps/src/CMakeLists.txt b/examples/comp_deps/src/CMakeLists.txt index 77ae38be..2f1060a2 100644 --- a/examples/comp_deps/src/CMakeLists.txt +++ b/examples/comp_deps/src/CMakeLists.txt @@ -1,3 +1,3 @@ -ign_get_libsources_and_unittests(sources gtest_sources) +gz_get_libsources_and_unittests(sources gtest_sources) ign_create_core_library(SOURCES ${sources}) diff --git a/examples/core_child/src/CMakeLists.txt b/examples/core_child/src/CMakeLists.txt index 82c11722..e08a4323 100644 --- a/examples/core_child/src/CMakeLists.txt +++ b/examples/core_child/src/CMakeLists.txt @@ -1,6 +1,6 @@ -ign_get_libsources_and_unittests(sources gtest_sources) +gz_get_libsources_and_unittests(sources gtest_sources) ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11) target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME} PUBLIC ignition-core_no_deps::ignition-core_no_deps) -ign_build_tests(TYPE UNIT SOURCES ${gtest_sources}) +gz_build_tests(TYPE UNIT SOURCES ${gtest_sources}) diff --git a/examples/core_child_private/src/CMakeLists.txt b/examples/core_child_private/src/CMakeLists.txt index 29014808..07e40d4d 100644 --- a/examples/core_child_private/src/CMakeLists.txt +++ b/examples/core_child_private/src/CMakeLists.txt @@ -1,6 +1,6 @@ -ign_get_libsources_and_unittests(sources gtest_sources) +gz_get_libsources_and_unittests(sources gtest_sources) ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11) target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME} PRIVATE ignition-core_no_deps::ignition-core_no_deps) -ign_build_tests(TYPE UNIT SOURCES ${gtest_sources}) +gz_build_tests(TYPE UNIT SOURCES ${gtest_sources}) diff --git a/examples/core_nodep/src/CMakeLists.txt b/examples/core_nodep/src/CMakeLists.txt index 05b85543..6724df79 100644 --- a/examples/core_nodep/src/CMakeLists.txt +++ b/examples/core_nodep/src/CMakeLists.txt @@ -1,3 +1,3 @@ -ign_get_libsources_and_unittests(sources gtest_sources) +gz_get_libsources_and_unittests(sources gtest_sources) ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11) -ign_build_tests(TYPE UNIT SOURCES ${gtest_sources}) +gz_build_tests(TYPE UNIT SOURCES ${gtest_sources}) diff --git a/examples/core_nodep_static/src/CMakeLists.txt b/examples/core_nodep_static/src/CMakeLists.txt index 05b85543..6724df79 100644 --- a/examples/core_nodep_static/src/CMakeLists.txt +++ b/examples/core_nodep_static/src/CMakeLists.txt @@ -1,3 +1,3 @@ -ign_get_libsources_and_unittests(sources gtest_sources) +gz_get_libsources_and_unittests(sources gtest_sources) ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11) -ign_build_tests(TYPE UNIT SOURCES ${gtest_sources}) +gz_build_tests(TYPE UNIT SOURCES ${gtest_sources}) diff --git a/examples/core_static_child/src/CMakeLists.txt b/examples/core_static_child/src/CMakeLists.txt index 400f4ecd..dd8bcdf4 100644 --- a/examples/core_static_child/src/CMakeLists.txt +++ b/examples/core_static_child/src/CMakeLists.txt @@ -1,6 +1,6 @@ -ign_get_libsources_and_unittests(sources gtest_sources) +gz_get_libsources_and_unittests(sources gtest_sources) ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11) target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME} PUBLIC ignition-core_no_deps_static::ignition-core_no_deps_static) -ign_build_tests(TYPE UNIT SOURCES ${gtest_sources}) +gz_build_tests(TYPE UNIT SOURCES ${gtest_sources}) diff --git a/examples/no_ignition_prefix/include/no_ign/CMakeLists.txt b/examples/no_ignition_prefix/include/no_ign/CMakeLists.txt index 439642e6..bf4411e8 100644 --- a/examples/no_ignition_prefix/include/no_ign/CMakeLists.txt +++ b/examples/no_ignition_prefix/include/no_ign/CMakeLists.txt @@ -1 +1 @@ -ign_install_all_headers() +gz_install_all_headers() diff --git a/examples/no_ignition_prefix/src/CMakeLists.txt b/examples/no_ignition_prefix/src/CMakeLists.txt index 05b85543..6724df79 100644 --- a/examples/no_ignition_prefix/src/CMakeLists.txt +++ b/examples/no_ignition_prefix/src/CMakeLists.txt @@ -1,3 +1,3 @@ -ign_get_libsources_and_unittests(sources gtest_sources) +gz_get_libsources_and_unittests(sources gtest_sources) ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11) -ign_build_tests(TYPE UNIT SOURCES ${gtest_sources}) +gz_build_tests(TYPE UNIT SOURCES ${gtest_sources}) diff --git a/examples/sanitizers/src/CMakeLists.txt b/examples/sanitizers/src/CMakeLists.txt index f59796cb..7de535cc 100644 --- a/examples/sanitizers/src/CMakeLists.txt +++ b/examples/sanitizers/src/CMakeLists.txt @@ -1,3 +1,3 @@ -ign_get_libsources_and_unittests(sources gtest_sources) +gz_get_libsources_and_unittests(sources gtest_sources) ign_add_executable(asanfail ${sources}) add_test(asan asanfail) diff --git a/examples/use_component_depsA/src/CMakeLists.txt b/examples/use_component_depsA/src/CMakeLists.txt index 1344fa3f..f27b9277 100644 --- a/examples/use_component_depsA/src/CMakeLists.txt +++ b/examples/use_component_depsA/src/CMakeLists.txt @@ -1,6 +1,6 @@ -ign_get_libsources_and_unittests(sources gtest_sources) +gz_get_libsources_and_unittests(sources gtest_sources) ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11) target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME} PUBLIC ignition-component_deps::ignition-component_deps-child) -ign_build_tests(TYPE UNIT SOURCES ${gtest_sources}) +gz_build_tests(TYPE UNIT SOURCES ${gtest_sources}) diff --git a/examples/use_component_depsB/src/CMakeLists.txt b/examples/use_component_depsB/src/CMakeLists.txt index 1344fa3f..f27b9277 100644 --- a/examples/use_component_depsB/src/CMakeLists.txt +++ b/examples/use_component_depsB/src/CMakeLists.txt @@ -1,6 +1,6 @@ -ign_get_libsources_and_unittests(sources gtest_sources) +gz_get_libsources_and_unittests(sources gtest_sources) ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11) target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME} PUBLIC ignition-component_deps::ignition-component_deps-child) -ign_build_tests(TYPE UNIT SOURCES ${gtest_sources}) +gz_build_tests(TYPE UNIT SOURCES ${gtest_sources}) diff --git a/examples/use_component_depsC/src/CMakeLists.txt b/examples/use_component_depsC/src/CMakeLists.txt index 1344fa3f..f27b9277 100644 --- a/examples/use_component_depsC/src/CMakeLists.txt +++ b/examples/use_component_depsC/src/CMakeLists.txt @@ -1,6 +1,6 @@ -ign_get_libsources_and_unittests(sources gtest_sources) +gz_get_libsources_and_unittests(sources gtest_sources) ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11) target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME} PUBLIC ignition-component_deps::ignition-component_deps-child) -ign_build_tests(TYPE UNIT SOURCES ${gtest_sources}) +gz_build_tests(TYPE UNIT SOURCES ${gtest_sources})