diff --git a/cmake/IgnPackaging.cmake b/cmake/IgnPackaging.cmake index 22c09506..a98013ea 100644 --- a/cmake/IgnPackaging.cmake +++ b/cmake/IgnPackaging.cmake @@ -174,7 +174,7 @@ endmacro() # If the target is a component, pass in the COMPONENT argument followed by the # component's name. # -# NOTE: This will be called automatically by ign_create_core_library(~) and +# NOTE: This will be called automatically by gz_create_core_library(~) and # ign_add_component(~), so users of ignition-cmake should not call this # function. # @@ -234,7 +234,7 @@ endfunction() # variable names (like SDFormat_LIBRARIES), the LEGACY_PROJECT_PREFIX argument # can be used to specify the prefix of these variables. # -# NOTE: This will be called automatically by ign_create_core_library(~) and +# NOTE: This will be called automatically by gz_create_core_library(~) and # ign_add_component(~), so users of ignition-cmake should not call this # function. # diff --git a/cmake/IgnUtils.cmake b/cmake/IgnUtils.cmake index ef2cebf8..a3131eb9 100644 --- a/cmake/IgnUtils.cmake +++ b/cmake/IgnUtils.cmake @@ -522,7 +522,7 @@ endmacro() # 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(~), +# These output variables can be consumed directly by gz_create_core_library(~), # ign_add_component(~), ign_build_tests(~), and ign_build_executables(~). function(ign_get_libsources_and_unittests lib_sources_var tests_var) @@ -820,7 +820,7 @@ endfunction() # # ) # -# Handles the C++ standard argument for ign_create_core_library(~) and +# Handles the C++ standard argument for gz_create_core_library(~) and # ign_add_component(~). # # NOTE: This is only meant for internal ign-cmake use. @@ -866,7 +866,7 @@ macro(_gz_handle_cxx_standard prefix target pkgconfig_cflags) endmacro() ################################################# -# ign_create_core_library(SOURCES +# gz_create_core_library(SOURCES # [CXX_STANDARD <11|14|17>] # [PRIVATE_CXX_STANDARD <11|14|17>] # [INTERFACE_CXX_STANDARD <11|14|17>] @@ -910,21 +910,40 @@ endmacro() # are not allowed to use either of them if you use the CXX_STANDARD argument. # function(ign_create_core_library) + # TODO(chapulina) Enable warnings after all libraries have migrated. + # message(WARNING "ign_create_core_library is deprecated, use gz_create_core_library instead.") - #------------------------------------ - # Define the expected arguments set(options INTERFACE) set(oneValueArgs INCLUDE_SUBDIR LEGACY_PROJECT_PREFIX CXX_STANDARD PRIVATE_CXX_STANDARD INTERFACE_CXX_STANDARD GET_TARGET_NAME) set(multiValueArgs SOURCES) - - #------------------------------------ - # Parse the arguments cmake_parse_arguments(gz_create_core_library "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + set(gz_create_core_library_skip_parsing true) + gz_create_core_library() + + if(gz_create_core_library_GET_TARGET_NAME) + set(${gz_create_core_library_GET_TARGET_NAME} ${${gz_create_core_library_GET_TARGET_NAME}} PARENT_SCOPE) + endif() +endfunction() +function(gz_create_core_library) + + # Deprecated, remove skip parsing logic in version 4 + if (NOT gz_create_core_library_skip_parsing) + #------------------------------------ + # Define the expected arguments + set(options INTERFACE) + set(oneValueArgs INCLUDE_SUBDIR LEGACY_PROJECT_PREFIX CXX_STANDARD PRIVATE_CXX_STANDARD INTERFACE_CXX_STANDARD GET_TARGET_NAME) + set(multiValueArgs SOURCES) + + #------------------------------------ + # Parse the arguments + cmake_parse_arguments(gz_create_core_library "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + endif() + if(gz_create_core_library_SOURCES) set(sources ${gz_create_core_library_SOURCES}) elseif(NOT gz_create_core_library_INTERFACE) - message(FATAL_ERROR "You must specify SOURCES for ign_create_core_library(~)!") + message(FATAL_ERROR "You must specify SOURCES for gz_create_core_library(~)!") endif() if(gz_create_core_library_INTERFACE) @@ -1065,7 +1084,7 @@ endfunction() # with the core library), but the component itself does not need to link to # the core library. # -# See the documentation of ign_create_core_library(~) for more information about +# See the documentation of gz_create_core_library(~) for more information about # specifying the C++ standard. If your component publicly depends on the core # library, then you probably do not need to specify the standard, because it # will get inherited from the core library. @@ -1311,7 +1330,7 @@ endmacro() ################################################# # This is only meant for internal use by ignition-cmake. If you are a consumer -# of ignition-cmake, please use ign_create_core_library(~) or +# of ignition-cmake, please use gz_create_core_library(~) or # ign_add_component(~) instead of this. # # _gz_add_library_or_component(LIB_NAME diff --git a/examples/comp_deps/src/CMakeLists.txt b/examples/comp_deps/src/CMakeLists.txt index 77ae38be..63c30f29 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) -ign_create_core_library(SOURCES ${sources}) +gz_create_core_library(SOURCES ${sources}) diff --git a/examples/core_child/src/CMakeLists.txt b/examples/core_child/src/CMakeLists.txt index 82c11722..f8952dad 100644 --- a/examples/core_child/src/CMakeLists.txt +++ b/examples/core_child/src/CMakeLists.txt @@ -1,5 +1,5 @@ ign_get_libsources_and_unittests(sources gtest_sources) -ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11) +gz_create_core_library(SOURCES ${sources} CXX_STANDARD 11) target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME} PUBLIC ignition-core_no_deps::ignition-core_no_deps) diff --git a/examples/core_child_private/src/CMakeLists.txt b/examples/core_child_private/src/CMakeLists.txt index 29014808..7b942c5e 100644 --- a/examples/core_child_private/src/CMakeLists.txt +++ b/examples/core_child_private/src/CMakeLists.txt @@ -1,5 +1,5 @@ ign_get_libsources_and_unittests(sources gtest_sources) -ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11) +gz_create_core_library(SOURCES ${sources} CXX_STANDARD 11) target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME} PRIVATE ignition-core_no_deps::ignition-core_no_deps) diff --git a/examples/core_nodep/src/CMakeLists.txt b/examples/core_nodep/src/CMakeLists.txt index 05b85543..672314d7 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) -ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11) +gz_create_core_library(SOURCES ${sources} CXX_STANDARD 11) ign_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..672314d7 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) -ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11) +gz_create_core_library(SOURCES ${sources} CXX_STANDARD 11) ign_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..3f5b9973 100644 --- a/examples/core_static_child/src/CMakeLists.txt +++ b/examples/core_static_child/src/CMakeLists.txt @@ -1,5 +1,5 @@ ign_get_libsources_and_unittests(sources gtest_sources) -ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11) +gz_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) diff --git a/examples/no_ignition_prefix/src/CMakeLists.txt b/examples/no_ignition_prefix/src/CMakeLists.txt index 05b85543..672314d7 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) -ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11) +gz_create_core_library(SOURCES ${sources} CXX_STANDARD 11) ign_build_tests(TYPE UNIT SOURCES ${gtest_sources}) diff --git a/examples/prerelease/src/CMakeLists.txt b/examples/prerelease/src/CMakeLists.txt index 0e040889..abbf74b3 100644 --- a/examples/prerelease/src/CMakeLists.txt +++ b/examples/prerelease/src/CMakeLists.txt @@ -1,3 +1,3 @@ -ign_create_core_library(INTERFACE) +gz_create_core_library(INTERFACE) diff --git a/examples/use_component_depsA/src/CMakeLists.txt b/examples/use_component_depsA/src/CMakeLists.txt index 1344fa3f..9777a1c5 100644 --- a/examples/use_component_depsA/src/CMakeLists.txt +++ b/examples/use_component_depsA/src/CMakeLists.txt @@ -1,5 +1,5 @@ ign_get_libsources_and_unittests(sources gtest_sources) -ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11) +gz_create_core_library(SOURCES ${sources} CXX_STANDARD 11) target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME} PUBLIC ignition-component_deps::ignition-component_deps-child) diff --git a/examples/use_component_depsB/src/CMakeLists.txt b/examples/use_component_depsB/src/CMakeLists.txt index 1344fa3f..9777a1c5 100644 --- a/examples/use_component_depsB/src/CMakeLists.txt +++ b/examples/use_component_depsB/src/CMakeLists.txt @@ -1,5 +1,5 @@ ign_get_libsources_and_unittests(sources gtest_sources) -ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11) +gz_create_core_library(SOURCES ${sources} CXX_STANDARD 11) target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME} PUBLIC ignition-component_deps::ignition-component_deps-child) diff --git a/examples/use_component_depsC/src/CMakeLists.txt b/examples/use_component_depsC/src/CMakeLists.txt index 1344fa3f..9777a1c5 100644 --- a/examples/use_component_depsC/src/CMakeLists.txt +++ b/examples/use_component_depsC/src/CMakeLists.txt @@ -1,5 +1,5 @@ ign_get_libsources_and_unittests(sources gtest_sources) -ign_create_core_library(SOURCES ${sources} CXX_STANDARD 11) +gz_create_core_library(SOURCES ${sources} CXX_STANDARD 11) target_link_libraries(${PROJECT_LIBRARY_TARGET_NAME} PUBLIC ignition-component_deps::ignition-component_deps-child)