From 8572411a2eea684d74ec188d432824761fe91d73 Mon Sep 17 00:00:00 2001 From: Louise Poubel Date: Thu, 16 Jun 2022 11:46:45 -0700 Subject: [PATCH] Deprecate public ign functions in favor of gz (#250) Signed-off-by: Louise Poubel Signed-off-by: methylDragon Co-authored-by: Steve Peters Co-authored-by: methylDragon --- MigrationFromClassic.md | 40 +++++------ cmake/FindAVCODEC.cmake | 2 +- cmake/FindAVDEVICE.cmake | 2 +- cmake/FindAVFORMAT.cmake | 2 +- cmake/FindAVUTIL.cmake | 2 +- cmake/FindDL.cmake | 4 +- cmake/FindEIGEN3.cmake | 8 +-- cmake/FindFreeImage.cmake | 4 +- cmake/FindGTS.cmake | 6 +- cmake/FindIgnCURL.cmake | 2 +- cmake/FindIgnOGRE.cmake | 6 +- cmake/FindIgnOGRE2.cmake | 6 +- cmake/FindIgnProtobuf.cmake | 2 +- cmake/FindIgnURDFDOM.cmake | 2 +- cmake/FindJSONCPP.cmake | 4 +- cmake/FindOptiX.cmake | 2 +- cmake/FindSQLite3.cmake | 4 +- cmake/FindSWSCALE.cmake | 2 +- cmake/FindTINYXML2.cmake | 2 +- cmake/FindUUID.cmake | 2 +- cmake/FindYAML.cmake | 2 +- cmake/FindZIP.cmake | 2 +- cmake/FindZeroMQ.cmake | 4 +- cmake/IgnBenchmark.cmake | 2 +- cmake/IgnManualSearch.cmake | 4 +- cmake/IgnPkgConfig.cmake | 65 ++++++++++++----- cmake/IgnUtils.cmake | 91 +++++++++++++++++------- cmake/ignition-component-config.cmake.in | 2 +- cmake/ignition-config.cmake.in | 2 +- examples/CMakeLists.txt | 2 +- examples/comp_deps/child/CMakeLists.txt | 2 +- examples/comp_deps/parent/CMakeLists.txt | 2 +- 32 files changed, 180 insertions(+), 104 deletions(-) diff --git a/MigrationFromClassic.md b/MigrationFromClassic.md index 25c03ec0..15a054c8 100644 --- a/MigrationFromClassic.md +++ b/MigrationFromClassic.md @@ -63,14 +63,14 @@ Any operations that might need to be performed while searching for a package should be done in a find-module. See the section on anti-patterns for more information on writing find-modules. -### Then call `ign_configure_build(~)` +### Then call `gz_configure_build(~)` This macro accepts the argument `QUIT_IF_BUILD_ERRORS` which you should pass to it to get the standard behavior for the ignition projects. If for some reason you want to handle build errors in your own way, you can leave that argument out and then do as you please after the macro finishes. -### Finally, call `ign_create_packages()` +### Finally, call `gz_create_packages()` After this, your top-level `CMakeLists.txt` is finished. The remaining changes listed below must be applied throughout your directory tree. @@ -108,10 +108,10 @@ should not be using the CMake cache except to allow human users to set build options. For more explanation about why and how we should avoid using the cache, see the below section on CMake anti-patterns. -### Replace `ign_add_library(${PROJECT_LIBRARY_TARGET_NAME} ${sources})` with `ign_create_core_library(SOURCES ${sources})` +### Replace `gz_add_library(${PROJECT_LIBRARY_TARGET_NAME} ${sources})` with `gz_create_core_library(SOURCES ${sources})` -The `ign_add_library(~)` macro has been removed and replaced with the macro -`ign_create_core_library(~)`. With this new macro, you no longer need to specify +The `gz_add_library(~)` macro has been removed and replaced with the macro +`gz_create_core_library(~)`. With this new macro, you no longer need to specify the library name, because it will be inferred from your project information. Instead, you should pass the `SOURCES` argument, followed by the source files which will be used to generate your library. @@ -121,17 +121,17 @@ library requires (current options are 11 or 14). Note that if your library requires a certain standard, it MUST be specified directly to this function in order to ensure that the requirement gets correctly propagated into the project's package information so that dependent libraries will also be aware of -the requirement. See the documentation of `ign_create_core_library(~)` in +the requirement. See the documentation of `gz_create_core_library(~)` in `ign-cmake/cmake/IgnUtils.cmake` for more details on how to specify your library's C++ standard requirement. -### Specify `TYPE` and `SOURCES` arguments in `ign_build_tests(~)` +### Specify `TYPE` and `SOURCES` arguments in `gz_build_tests(~)` Previously, ignition libraries would set a `TEST_TYPE` variable before calling -`ign_build_tests(~)`, and that variable would be used by the macro to determine +`gz_build_tests(~)`, and that variable would be used by the macro to determine the type of tests it should create. This resulted in some anti-patterns where the `TEST_TYPE` variable would be set somewhere far away from the call to -`ign_build_tests(~)`, making it unclear to a human reader what type of tests the +`gz_build_tests(~)`, making it unclear to a human reader what type of tests the call would produce. Instead, we now explicitly specify the test type using the `TYPE` tag when calling the macro, and to avoid confusion with backwards compatibility, the `SOURCES` tag must be used before specifying sources. We are @@ -148,7 +148,7 @@ will make `LIB_DEPS` unnecessary, but it is still provided for edge cases. Note that when individual tests depend on additional libraries, those individual tests should be linked to their dependencies using `target_link_libraries( )` after the call to -`ign_build_tests(~)`. `LIB_DEPS` should only be used for dependencies that are +`gz_build_tests(~)`. `LIB_DEPS` should only be used for dependencies that are needed by (nearly) all of the tests. For component libraries, you can use `LIB_DEPS` to have the tests link to your component library. @@ -192,7 +192,7 @@ to. Note that you must also specify which targets' interface include directories will be needed by libraries which depend on your project's library. This should -be done using `ign_target_interface_include_directories( )`. +be done using `gz_target_interface_include_directories( )`. That function will add the interface include directories of the dependency targets that you pass in to the interface include directory list of `` in a way which is relocatable by using generator expressions. @@ -218,9 +218,9 @@ find-module, the macro `gz_import_target(~)` should be used generate an imported target which follows this convention. More about creating find-modules can be found in the section on anti-patterns. -### Remove ign_install_library() +### Remove gz_install_library() -Calling `ign_create_core_library()` will also take care of installing the +Calling `gz_create_core_library()` will also take care of installing the library. Simply remove this function from your cmake script. ### Replace calls to `#include "ignition//System.hh"` with `#include "ignition//Export.hh"`, and delete the file `System.hh`. @@ -261,7 +261,7 @@ that are not already present in `ign-cmake`, then you should add those features to `ign-cmake` and submit a pull request. I will try to be very prompt about reviewing and approving those PRs. -### To add a component library, use `ign_add_component( SOURCES ${sources})` +### To add a component library, use `gz_add_component( SOURCES ${sources})` This new function allows you to create a "component" library which will be compiled separately from your core library. It will be packaged as a cmake @@ -290,7 +290,7 @@ auto-generated name of the target. You can then use the target with The following changes are not necessary, but may improve the readability and maintainability of your CMake code. Use of these utilities is optional. -### GLOB up library source files and unit test source files using `ign_get_libsources_and_unittests(sources tests)` +### GLOB up library source files and unit test source files using `gz_get_libsources_and_unittests(sources tests)` Placing this in `src/CMakeLists.txt` will collect all the source files in the directory and sort them into a `source` variable (containing the library sources) @@ -303,7 +303,7 @@ approach can be used to conditionally remove files from a list (see want a file to be excluded, you can change its extension (e.g. `*.cc.backup` or `.cc.old`) until a later time when you want it to be used again. -### Use `ign_install_all_headers(~)` in `include/ignition//CMakeLists.txt` +### Use `gz_install_all_headers(~)` in `include/ignition//CMakeLists.txt` Using this macro will install all files ending in `*.h` and `*.hh` in the current source directory recursively (so all the files in all subdirectories as @@ -315,10 +315,10 @@ installed. The argument `EXCLUDE_DIRS` lets you specify subdirectories to not install. Note that the files or directories must be specified relative to the current directory. -### Use `ign_get_sources(~)` in `test//CMakeLists.txt` to collect source files +### Use `gz_get_sources(~)` in `test//CMakeLists.txt` to collect source files -Similar to `ign_get_libsources_and_unittests(~)` except it only produces one -list of source files, which is sufficient to be passed to `ign_build_tests(~)`. +Similar to `gz_get_libsources_and_unittests(~)` except it only produces one +list of source files, which is sufficient to be passed to `gz_build_tests(~)`. @@ -378,7 +378,7 @@ writing a good quality find-module. In many cases, a package that we depend on will be distributed with a pkgconfig (`*.pc`) file. In such a case, `ignition-cmake` provides a macro that can easily find the package and create an imported target for it. Simply use `include(IgnPkgConfig)` -and then `ign_pkg_check_modules(~)` in your find-module, and you are done. An +and then `gz_pkg_check_modules(~)` in your find-module, and you are done. An example of a simple case of this can be found in `ign-cmake/cmake/FindGTS.cmake`. If certain version-based behavior is needed, that must be handled within the diff --git a/cmake/FindAVCODEC.cmake b/cmake/FindAVCODEC.cmake index 8d0bb263..f04fea88 100644 --- a/cmake/FindAVCODEC.cmake +++ b/cmake/FindAVCODEC.cmake @@ -16,7 +16,7 @@ ######################################## # Find avcodec include(IgnPkgConfig) -ign_pkg_check_modules_quiet(AVCODEC libavcodec) +gz_pkg_check_modules_quiet(AVCODEC libavcodec) if(NOT AVCODEC_FOUND) include(IgnManualSearch) diff --git a/cmake/FindAVDEVICE.cmake b/cmake/FindAVDEVICE.cmake index a731b13c..518a6df6 100644 --- a/cmake/FindAVDEVICE.cmake +++ b/cmake/FindAVDEVICE.cmake @@ -20,7 +20,7 @@ set(av_minor ${AVDEVICE_FIND_VERSION_MINOR}) set(av_patch ${AVDEVICE_FIND_VERSION_PATCH}) include(IgnPkgConfig) -ign_pkg_check_modules_quiet(AVDEVICE "libavdevice >= ${av_major}.${av_minor}.${av_patch}") +gz_pkg_check_modules_quiet(AVDEVICE "libavdevice >= ${av_major}.${av_minor}.${av_patch}") if(NOT AVDEVICE_FOUND) include(IgnManualSearch) diff --git a/cmake/FindAVFORMAT.cmake b/cmake/FindAVFORMAT.cmake index 241d9ad7..6cca98b3 100644 --- a/cmake/FindAVFORMAT.cmake +++ b/cmake/FindAVFORMAT.cmake @@ -16,7 +16,7 @@ ######################################## # Find AV format include(IgnPkgConfig) -ign_pkg_check_modules_quiet(AVFORMAT libavformat) +gz_pkg_check_modules_quiet(AVFORMAT libavformat) if(NOT AVFORMAT_FOUND) include(IgnManualSearch) diff --git a/cmake/FindAVUTIL.cmake b/cmake/FindAVUTIL.cmake index 57d2128d..4b34ae59 100644 --- a/cmake/FindAVUTIL.cmake +++ b/cmake/FindAVUTIL.cmake @@ -16,7 +16,7 @@ ######################################## # Find avutil include(IgnPkgConfig) -ign_pkg_check_modules_quiet(AVUTIL libavutil) +gz_pkg_check_modules_quiet(AVUTIL libavutil) if(NOT AVUTIL_FOUND) include(IgnManualSearch) diff --git a/cmake/FindDL.cmake b/cmake/FindDL.cmake index 0305d053..a11c587e 100644 --- a/cmake/FindDL.cmake +++ b/cmake/FindDL.cmake @@ -93,9 +93,9 @@ else() endif() # We need to manually specify the pkgconfig entry (and type of entry) for dl, -# because ign_pkg_check_modules does not work for it. +# because gz_pkg_check_modules does not work for it. include(IgnPkgConfig) -ign_pkg_config_library_entry(DL dl) +gz_pkg_config_library_entry(DL dl) include(FindPackageHandleStandardArgs) find_package_handle_standard_args( diff --git a/cmake/FindEIGEN3.cmake b/cmake/FindEIGEN3.cmake index e14f4b18..4ca66759 100644 --- a/cmake/FindEIGEN3.cmake +++ b/cmake/FindEIGEN3.cmake @@ -36,9 +36,9 @@ if(EIGEN3_FOUND) TARGET_NAME Eigen3::Eigen) if(EIGEN3_FIND_VERSION) - ign_pkg_config_entry(EIGEN3 "eigen3 >= ${EIGEN3_FIND_VERSION}") + gz_pkg_config_entry(EIGEN3 "eigen3 >= ${EIGEN3_FIND_VERSION}") else() - ign_pkg_config_entry(EIGEN3 "eigen3") + gz_pkg_config_entry(EIGEN3 "eigen3") endif() return() @@ -46,11 +46,11 @@ if(EIGEN3_FOUND) endif() if(EIGEN3_FIND_VERSION) - ign_pkg_check_modules_quiet(EIGEN3 "eigen3 >= ${EIGEN3_FIND_VERSION}" + gz_pkg_check_modules_quiet(EIGEN3 "eigen3 >= ${EIGEN3_FIND_VERSION}" INTERFACE TARGET_NAME Eigen3::Eigen) else() - ign_pkg_check_modules_quiet(EIGEN3 "eigen3" + gz_pkg_check_modules_quiet(EIGEN3 "eigen3" INTERFACE TARGET_NAME Eigen3::Eigen) endif() diff --git a/cmake/FindFreeImage.cmake b/cmake/FindFreeImage.cmake index 4b4ef7df..0c40798d 100644 --- a/cmake/FindFreeImage.cmake +++ b/cmake/FindFreeImage.cmake @@ -25,7 +25,7 @@ set(full_version ${major_version}.${minor_version}) if (NOT WIN32) include(IgnPkgConfig) - ign_pkg_config_library_entry(FreeImage freeimage) + gz_pkg_config_library_entry(FreeImage freeimage) # If we don't have PkgConfig, or if PkgConfig failed, then do a manual search if(NOT FreeImage_FOUND) @@ -141,7 +141,7 @@ else() if (FreeImage_FOUND) include(IgnPkgConfig) - ign_pkg_config_library_entry(FreeImage "FreeImage") + gz_pkg_config_library_entry(FreeImage "FreeImage") include(IgnImportTarget) gz_import_target(FreeImage) endif() diff --git a/cmake/FindGTS.cmake b/cmake/FindGTS.cmake index b50894ce..a29f9659 100644 --- a/cmake/FindGTS.cmake +++ b/cmake/FindGTS.cmake @@ -19,7 +19,7 @@ if (NOT WIN32) # Configuration using pkg-config modules include(IgnPkgConfig) - ign_pkg_check_modules(GTS gts) + gz_pkg_check_modules(GTS gts) else() # true by default, change to false when a failure appears set(GTS_FOUND true) @@ -91,9 +91,9 @@ else() if (GTS_FOUND) # We need to manually specify the pkgconfig entry (and type of entry), - # because ign_pkg_check_modules does not work for it. + # because gz_pkg_check_modules does not work for it. include(IgnPkgConfig) - ign_pkg_config_library_entry(GTS gts) + gz_pkg_config_library_entry(GTS gts) include(IgnImportTarget) gz_import_target(GTS) endif() diff --git a/cmake/FindIgnCURL.cmake b/cmake/FindIgnCURL.cmake index 6bb7f1fa..aeb78972 100644 --- a/cmake/FindIgnCURL.cmake +++ b/cmake/FindIgnCURL.cmake @@ -61,6 +61,6 @@ if(${IgnCURL_FOUND}) endif() include(IgnPkgConfig) - ign_pkg_config_entry(IgnCURL "libcurl >= ${IgnCURL_FIND_VERSION}") + gz_pkg_config_entry(IgnCURL "libcurl >= ${IgnCURL_FIND_VERSION}") endif() diff --git a/cmake/FindIgnOGRE.cmake b/cmake/FindIgnOGRE.cmake index 1941ec59..572ad38f 100644 --- a/cmake/FindIgnOGRE.cmake +++ b/cmake/FindIgnOGRE.cmake @@ -92,7 +92,7 @@ if (NOT WIN32) set(OGRE_LIBRARY_DIRS "") set(OGRE_LIBRARIES "") set(ENV{PKG_CONFIG_PATH} ${pkg_path}) - ign_pkg_check_modules_quiet(OGRE "OGRE >= ${full_version}" + gz_pkg_check_modules_quiet(OGRE "OGRE >= ${full_version}" NO_CMAKE_ENVIRONMENT_PATH QUIET) if (OGRE_FOUND) @@ -140,7 +140,7 @@ if (NOT WIN32) # find ogre components foreach(component ${IgnOGRE_FIND_COMPONENTS}) - ign_pkg_check_modules_quiet(IgnOGRE-${component} "OGRE-${component} >= ${full_version}" NO_CMAKE_ENVIRONMENT_PATH) + gz_pkg_check_modules_quiet(IgnOGRE-${component} "OGRE-${component} >= ${full_version}" NO_CMAKE_ENVIRONMENT_PATH) if(IgnOGRE-${component}_FOUND) list(APPEND OGRE_LIBRARIES IgnOGRE-${component}::IgnOGRE-${component}) elseif(IgnOGRE_FIND_REQUIRED_${component}) @@ -158,7 +158,7 @@ if (NOT WIN32) set(OGRE_PLUGINDIR ${_pkgconfig_invoke_result}) endif() - ign_pkg_config_library_entry(IgnOGRE OgreMain) + gz_pkg_config_library_entry(IgnOGRE OgreMain) set(OGRE_RESOURCE_PATH ${OGRE_PLUGINDIR}) # Seems that OGRE_PLUGINDIR can end in a newline, which will cause problems diff --git a/cmake/FindIgnOGRE2.cmake b/cmake/FindIgnOGRE2.cmake index 87e8ceb1..5804b014 100644 --- a/cmake/FindIgnOGRE2.cmake +++ b/cmake/FindIgnOGRE2.cmake @@ -155,7 +155,7 @@ if (NOT WIN32) # Note: OGRE2 installed from debs is named OGRE-2.2 while the version # installed from source does not have the 2.2 suffix # look for OGRE2 installed from debs - ign_pkg_check_modules_quiet(${IGN_OGRE2_PROJECT_NAME} ${OGRE2_INSTALL_PATH} NO_CMAKE_ENVIRONMENT_PATH QUIET) + gz_pkg_check_modules_quiet(${IGN_OGRE2_PROJECT_NAME} ${OGRE2_INSTALL_PATH} NO_CMAKE_ENVIRONMENT_PATH QUIET) if (${IGN_OGRE2_PROJECT_NAME}_FOUND) set(IGN_PKG_NAME ${OGRE2_INSTALL_PATH}) @@ -338,9 +338,9 @@ if (NOT WIN32) fix_pkgconfig_resource_path_jammy_bug("${OGRE2_RESOURCE_PATH}" OGRE2_RESOURCE_PATH) # We need to manually specify the pkgconfig entry (and type of entry), - # because ign_pkg_check_modules does not work for it. + # because gz_pkg_check_modules does not work for it. include(IgnPkgConfig) - ign_pkg_config_library_entry(IgnOGRE2 OgreMain) + gz_pkg_config_library_entry(IgnOGRE2 OgreMain) else() #WIN32 set(OGRE2_FOUND TRUE) diff --git a/cmake/FindIgnProtobuf.cmake b/cmake/FindIgnProtobuf.cmake index f8c015d1..f367c8bb 100644 --- a/cmake/FindIgnProtobuf.cmake +++ b/cmake/FindIgnProtobuf.cmake @@ -24,7 +24,7 @@ # support shared library versions of Protobuf. include(IgnPkgConfig) -ign_pkg_config_entry(IgnProtobuf "protobuf >= ${IgnProtobuf_FIND_VERSION}") +gz_pkg_config_entry(IgnProtobuf "protobuf >= ${IgnProtobuf_FIND_VERSION}") find_package(Protobuf ${IgnProtobuf_FIND_VERSION} QUIET CONFIG) diff --git a/cmake/FindIgnURDFDOM.cmake b/cmake/FindIgnURDFDOM.cmake index b76f235e..ac34008b 100644 --- a/cmake/FindIgnURDFDOM.cmake +++ b/cmake/FindIgnURDFDOM.cmake @@ -23,7 +23,7 @@ if(PKG_CONFIG_FOUND) else() set(signature "urdfdom") endif() - ign_pkg_check_modules(IgnURDFDOM "${signature}") + gz_pkg_check_modules(IgnURDFDOM "${signature}") else() message(VERBOSE "Unable to find pkg-config in the system, fallback to use CMake") endif() diff --git a/cmake/FindJSONCPP.cmake b/cmake/FindJSONCPP.cmake index fe710bac..aa80a976 100644 --- a/cmake/FindJSONCPP.cmake +++ b/cmake/FindJSONCPP.cmake @@ -36,9 +36,9 @@ else() include(IgnPkgConfig) if(JSONCPP_FOUND) - ign_pkg_config_entry(JSONCPP jsoncpp) + gz_pkg_config_entry(JSONCPP jsoncpp) else() - ign_pkg_check_modules_quiet(JSONCPP jsoncpp) + gz_pkg_check_modules_quiet(JSONCPP jsoncpp) set(JSONCPP_TARGET JSONCPP::JSONCPP) # If that failed, then fall back to manual detection. diff --git a/cmake/FindOptiX.cmake b/cmake/FindOptiX.cmake index a681fd5b..af1d1e7f 100644 --- a/cmake/FindOptiX.cmake +++ b/cmake/FindOptiX.cmake @@ -234,5 +234,5 @@ find_package_handle_standard_args( REQUIRED_VARS OptiX_FOUND) include(IgnPkgConfig) -ign_pkg_config_library_entry(OptiX OptiX) +gz_pkg_config_library_entry(OptiX OptiX) diff --git a/cmake/FindSQLite3.cmake b/cmake/FindSQLite3.cmake index a3ee8b9a..27431b13 100644 --- a/cmake/FindSQLite3.cmake +++ b/cmake/FindSQLite3.cmake @@ -26,9 +26,9 @@ # SQLite3_FOUND System has sqlite3 library and headers if(SQLite3_FIND_VERSION) - ign_pkg_check_modules_quiet(SQLite3 "sqlite3 >= ${SQLite3_FIND_VERSION}") + gz_pkg_check_modules_quiet(SQLite3 "sqlite3 >= ${SQLite3_FIND_VERSION}") else() - ign_pkg_check_modules_quiet(SQLite3 "sqlite") + gz_pkg_check_modules_quiet(SQLite3 "sqlite") endif() if(MSVC) diff --git a/cmake/FindSWSCALE.cmake b/cmake/FindSWSCALE.cmake index 226c6f90..da6f8c10 100644 --- a/cmake/FindSWSCALE.cmake +++ b/cmake/FindSWSCALE.cmake @@ -16,7 +16,7 @@ ######################################## # Find libswscale format include(IgnPkgConfig) -ign_pkg_check_modules_quiet(SWSCALE libswscale) +gz_pkg_check_modules_quiet(SWSCALE libswscale) if(NOT SWSCALE_FOUND) include(IgnManualSearch) diff --git a/cmake/FindTINYXML2.cmake b/cmake/FindTINYXML2.cmake index de5f2d13..a20c028b 100644 --- a/cmake/FindTINYXML2.cmake +++ b/cmake/FindTINYXML2.cmake @@ -19,7 +19,7 @@ include(IgnPkgConfig) # Use pkg_check_modules to start -ign_pkg_check_modules_quiet(TINYXML2 tinyxml2) +gz_pkg_check_modules_quiet(TINYXML2 tinyxml2) # If that failed, then fall back to manual detection (necessary for MacOS) if(NOT TINYXML2_FOUND) diff --git a/cmake/FindUUID.cmake b/cmake/FindUUID.cmake index cd337ef0..f1000001 100644 --- a/cmake/FindUUID.cmake +++ b/cmake/FindUUID.cmake @@ -18,7 +18,7 @@ if (UNIX) if(NOT APPLE) include(IgnPkgConfig) - ign_pkg_check_modules_quiet(UUID uuid) + gz_pkg_check_modules_quiet(UUID uuid) if(NOT UUID_FOUND) include(IgnManualSearch) diff --git a/cmake/FindYAML.cmake b/cmake/FindYAML.cmake index 893e2f2b..54950aa9 100644 --- a/cmake/FindYAML.cmake +++ b/cmake/FindYAML.cmake @@ -52,7 +52,7 @@ if(YAML_FIND_VERSION AND NOT YAML_FIND_VERSION VERSION_EQUAL "0.1") "but you requested version ${YAML_FIND_VERSION}.") else() include(IgnPkgConfig) - ign_pkg_check_modules_quiet(YAML yaml-0.1) + gz_pkg_check_modules_quiet(YAML yaml-0.1) # If that failed, then fall back to manual detection. if(NOT YAML_FOUND) diff --git a/cmake/FindZIP.cmake b/cmake/FindZIP.cmake index 67c357d1..c12c4395 100644 --- a/cmake/FindZIP.cmake +++ b/cmake/FindZIP.cmake @@ -27,7 +27,7 @@ # ZIP_LIBRARIES The ZIP libraries include(IgnPkgConfig) -ign_pkg_check_modules_quiet(ZIP libzip) +gz_pkg_check_modules_quiet(ZIP libzip) # If that failed, then fall back to manual detection. if(NOT ZIP_FOUND) diff --git a/cmake/FindZeroMQ.cmake b/cmake/FindZeroMQ.cmake index 46389486..e18eb1d0 100644 --- a/cmake/FindZeroMQ.cmake +++ b/cmake/FindZeroMQ.cmake @@ -68,7 +68,7 @@ if (ZeroMQ_FOUND) set(ZeroMQ_TARGET libzmq) # Make sure to fill out the pkg-config information before quitting - ign_pkg_config_entry(ZeroMQ "libzmq >= ${ZeroMQ_FIND_VERSION}") + gz_pkg_config_entry(ZeroMQ "libzmq >= ${ZeroMQ_FIND_VERSION}") return() @@ -80,6 +80,6 @@ if (UNIX) message(STATUS "Config-file not installed for ZeroMQ -- checking for pkg-config") endif() - ign_pkg_check_modules(ZeroMQ "libzmq >= ${ZeroMQ_FIND_VERSION}") + gz_pkg_check_modules(ZeroMQ "libzmq >= ${ZeroMQ_FIND_VERSION}") endif() diff --git a/cmake/IgnBenchmark.cmake b/cmake/IgnBenchmark.cmake index db7e635c..d398f807 100644 --- a/cmake/IgnBenchmark.cmake +++ b/cmake/IgnBenchmark.cmake @@ -72,7 +72,7 @@ function(ign_add_benchmarks) return() endif() - ign_build_executables( + gz_build_executables( PREFIX "BENCHMARK_" SOURCES ${BENCHMARK_SOURCES} LIB_DEPS benchmark::benchmark diff --git a/cmake/IgnManualSearch.cmake b/cmake/IgnManualSearch.cmake index 551b8191..644b806f 100644 --- a/cmake/IgnManualSearch.cmake +++ b/cmake/IgnManualSearch.cmake @@ -23,7 +23,7 @@ # This macro will find a library based on the name of one of its headers, # and the library name. # It is used inside Find***.cmake scripts, typicall as fallback for a -# ign_pkg_check_modules_quiet call. +# gz_pkg_check_modules_quiet call. # It will create an imported target for the library # # INTERFACE: Optional. Use INTERFACE when the target does not actually provide @@ -109,7 +109,7 @@ macro(gz_manual_search PACKAGE_NAME) if(${package}_FOUND) include(IgnImportTarget) gz_import_target(${package} ${_gz_pkg_check_modules_interface_option} - TARGET_NAME ${ign_pkg_check_modules_TARGET_NAME}) + TARGET_NAME ${gz_pkg_check_modules_TARGET_NAME}) endif() endmacro() diff --git a/cmake/IgnPkgConfig.cmake b/cmake/IgnPkgConfig.cmake index f7b6032d..327c191e 100644 --- a/cmake/IgnPkgConfig.cmake +++ b/cmake/IgnPkgConfig.cmake @@ -20,29 +20,35 @@ # NOTE: This macro assumes that pkg-config is the only means by which you will # be searching for the package. If you intend to continue searching in the # event that pkg-config fails (or is unavailable), then you should instead -# call ign_pkg_check_modules_quiet(~). +# call gz_pkg_check_modules_quiet(~). # # NOTE: If you need to specify a version comparison for pkg-config, then your # second argument must be wrapped in quotes. E.g. if you want to find # version greater than or equal to 3.2.1 of a package called SomePackage # which is known to pkg-config as libsomepackage, then you should call -# ign_pkg_check_modules as follows: +# gz_pkg_check_modules as follows: # -# ign_pkg_check_modules(SomePackage "libsomepackage >= 3.2.1") +# gz_pkg_check_modules(SomePackage "libsomepackage >= 3.2.1") # # The quotes and spaces in the second argument are all very important in # order to ensure that our auto-generated *.pc file gets filled in # correctly. If you do not have any version requirements, then you can # simply leave all of that out: # -# ign_pkg_check_modules(SomePackage libsomepackage) +# gz_pkg_check_modules(SomePackage libsomepackage) # # Without the version comparison, the quotes and spacing are irrelevant. -# This usage note applies to ign_pkg_check_modules_quiet(~) as well. +# This usage note applies to gz_pkg_check_modules_quiet(~) as well. # macro(ign_pkg_check_modules package signature) + # TODO(chapulina) Enable warnings after all libraries have migrated. + # message(WARNING "ign_pkg_check_modules is deprecated, use gz_pkg_check_modules instead.") - ign_pkg_check_modules_quiet(${package} "${signature}" ${ARGN}) + gz_pkg_check_modules(${package} ${signature}) +endmacro() +macro(gz_pkg_check_modules package signature) + + gz_pkg_check_modules_quiet(${package} "${signature}" ${ARGN}) if(NOT PKG_CONFIG_FOUND) message(WARNING "The package [${package}] requires pkg-config in order to be found. " @@ -56,24 +62,39 @@ macro(ign_pkg_check_modules package signature) endmacro() -# This is an alternative to ign_pkg_check_modules(~) which you can use if you +# This is an alternative to gz_pkg_check_modules(~) which you can use if you # have an alternative way to look for the package if pkg-config is not available # or cannot find the requested package. This will still setup the pkg-config # variables for you, whether or not pkg-config is available. # -# For usage instructions, see ign_pkg_check_modules(~) above. +# For usage instructions, see gz_pkg_check_modules(~) above. macro(ign_pkg_check_modules_quiet package signature) + # TODO(chapulina) Enable warnings after all libraries have migrated. + # message(WARNING "ign_pkg_check_modules_quiet is deprecated, use gz_pkg_check_modules_quiet instead.") - #------------------------------------ - # Define the expected arguments set(options INTERFACE NO_CMAKE_ENVIRONMENT_PATH QUIET) set(oneValueArgs "TARGET_NAME") set(multiValueArgs) - - #------------------------------------ - # Parse the arguments _gz_cmake_parse_arguments(gz_pkg_check_modules "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + set(gz_pkg_check_modules_quiet_skip_parsing true) + gz_pkg_check_modules_quiet(${package} ${signature}) +endmacro() +macro(gz_pkg_check_modules_quiet package signature) + + # Deprecated, remove skip parsing logic in version 4 + if (NOT gz_pkg_check_modules_quiet_skip_parsing) + #------------------------------------ + # Define the expected arguments + set(options INTERFACE NO_CMAKE_ENVIRONMENT_PATH QUIET) + set(oneValueArgs "TARGET_NAME") + set(multiValueArgs) + + #------------------------------------ + # Parse the arguments + _gz_cmake_parse_arguments(gz_pkg_check_modules "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + endif() + if(gz_pkg_check_modules_INTERFACE) set(_gz_pkg_check_modules_interface_option INTERFACE) else() @@ -86,7 +107,7 @@ macro(ign_pkg_check_modules_quiet package signature) find_package(PkgConfig QUIET) - ign_pkg_config_entry(${package} "${signature}") + gz_pkg_config_entry(${package} "${signature}") if(PKG_CONFIG_FOUND) @@ -149,7 +170,7 @@ macro(ign_pkg_check_modules_quiet package signature) # For some reason, pkg_check_modules does not provide complete paths to the # libraries it returns, even though find_package is conventionally supposed # to provide complete library paths. Having only the library name is harmful - # to the ign_create_imported_target macro, so we will change the variable to + # to the gz_create_imported_target macro, so we will change the variable to # give it complete paths. # # TODO: How would we deal with multiple modules that are in different @@ -172,11 +193,17 @@ endmacro() # This creates variables which inform gz_find_package(~) that your package # should be found as a module by pkg-config. In most cases, this will be called -# implicitly by ign_pkg_check_modules[_quiet], but if a package provides both a +# implicitly by gz_pkg_check_modules[_quiet], but if a package provides both a # cmake config-file (*-config.cmake) and a pkg-config file (*.pc), then you can # use the cmake config-file to retrieve the package information, and then use # this macro to generate the relevant pkg-config information. macro(ign_pkg_config_entry package string) + # TODO(chapulina) Enable warnings after all libraries have migrated. + # message(WARNING "ign_pkg_config_entry is deprecated, use gz_pkg_config_entry instead.") + + gz_pkg_config_entry(${package} ${string}) +endmacro() +macro(gz_pkg_config_entry package string) set(${package}_PKGCONFIG_ENTRY "${string}") set(${package}_PKGCONFIG_TYPE PKGCONFIG_REQUIRES) @@ -188,6 +215,12 @@ endmacro() # find-module that handles a library package which does not install a pkg-config # .pc file. macro(ign_pkg_config_library_entry package lib_name) + # TODO(chapulina) Enable warnings after all libraries have migrated. + # message(WARNING "ign_pkg_config_library_entry is deprecated, use gz_pkg_config_library_entry instead.") + + gz_pkg_config_library_entry(${package} ${lib_name}) +endmacro() +macro(gz_pkg_config_library_entry package lib_name) set(${package}_PKGCONFIG_ENTRY "-l${lib_name}") set(${package}_PKGCONFIG_TYPE PKGCONFIG_LIBS) diff --git a/cmake/IgnUtils.cmake b/cmake/IgnUtils.cmake index 242c5f72..bbde0577 100644 --- a/cmake/IgnUtils.cmake +++ b/cmake/IgnUtils.cmake @@ -359,8 +359,8 @@ macro(gz_find_package PACKAGE_NAME) # Here we will set up the pkgconfig entry for this package. Ordinarily, # these variables should be set by the ign-cmake custom find-module for - # the package which should use ign_pkg_check_modules[_quiet] or - # ign_pkg_config_library_entry. However, that will not be performed by + # the package which should use gz_pkg_check_modules[_quiet] or + # gz_pkg_config_library_entry. However, that will not be performed by # third-party dependencies that provide their own find-module or their own # cmake config-module. Therefore, we provide the option of specifying # pkgconfig information through the call to gz_find_package. This also @@ -557,7 +557,7 @@ endmacro() # library source files and unittest source files . # # These output variables can be consumed directly by gz_create_core_library(~), -# ign_add_component(~), gz_build_tests(~), and ign_build_executables(~). +# gz_add_component(~), gz_build_tests(~), and gz_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.") @@ -618,7 +618,7 @@ endfunction() # # 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]. +# gz_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.") @@ -903,7 +903,7 @@ endfunction() # ) # # Handles the C++ standard argument for gz_create_core_library(~) and -# ign_add_component(~). +# gz_add_component(~). # # NOTE: This is only meant for internal ign-cmake use. # @@ -1111,7 +1111,7 @@ function(gz_create_core_library) endfunction() ################################################# -# ign_add_component( +# gz_add_component( # SOURCES | INTERFACE # [DEPENDS_ON_COMPONENTS ] # [INCLUDE_SUBDIR ] @@ -1171,17 +1171,37 @@ endfunction() # library, then you probably do not need to specify the standard, because it # will get inherited from the core library. function(ign_add_component component_name) + # TODO(chapulina) Enable warnings after all libraries have migrated. + # message(WARNING "ign_add_component is deprecated, use gz_add_component instead.") - #------------------------------------ - # Define the expected arguments set(options INTERFACE INDEPENDENT_FROM_PROJECT_LIB PRIVATELY_DEPENDS_ON_PROJECT_LIB INTERFACE_DEPENDS_ON_PROJECT_LIB) set(oneValueArgs INCLUDE_SUBDIR GET_TARGET_NAME) set(multiValueArgs SOURCES DEPENDS_ON_COMPONENTS) - - #------------------------------------ - # Parse the arguments cmake_parse_arguments(gz_add_component "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + set(gz_add_component_skip_parsing true) + gz_add_component(${component_name}) + + # Pass the component's target name back to the caller if requested + if(gz_add_component_GET_TARGET_NAME) + set(${gz_add_component_GET_TARGET_NAME} ${${gz_add_component_GET_TARGET_NAME}} PARENT_SCOPE) + endif() +endfunction() +function(gz_add_component component_name) + + # Deprecated, remove skip parsing logic in version 4 + if (NOT gz_add_component_skip_parsing) + #------------------------------------ + # Define the expected arguments + set(options INTERFACE INDEPENDENT_FROM_PROJECT_LIB PRIVATELY_DEPENDS_ON_PROJECT_LIB INTERFACE_DEPENDS_ON_PROJECT_LIB) + set(oneValueArgs INCLUDE_SUBDIR GET_TARGET_NAME) + set(multiValueArgs SOURCES DEPENDS_ON_COMPONENTS) + + #------------------------------------ + # Parse the arguments + cmake_parse_arguments(gz_add_component "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + endif() + if(POLICY CMP0079) cmake_policy(SET CMP0079 NEW) endif() @@ -1189,7 +1209,7 @@ function(ign_add_component component_name) if(gz_add_component_SOURCES) set(sources ${gz_add_component_SOURCES}) elseif(NOT gz_add_component_INTERFACE) - message(FATAL_ERROR "You must specify SOURCES for ign_add_component(~)!") + message(FATAL_ERROR "You must specify SOURCES for gz_add_component(~)!") endif() if(gz_add_component_INCLUDE_SUBDIR) @@ -1271,7 +1291,7 @@ function(ign_add_component component_name) #------------------------------------ # Adjust variables if a specific C++ standard was requested - _gz_handle_cxx_standard(ign_add_component + _gz_handle_cxx_standard(gz_add_component ${component_target_name} ${component_name}_PKGCONFIG_CFLAGS) @@ -1413,7 +1433,7 @@ endmacro() ################################################# # This is only meant for internal use by ignition-cmake. If you are a consumer # of ignition-cmake, please use gz_create_core_library(~) or -# ign_add_component(~) instead of this. +# gz_add_component(~) instead of this. # # _gz_add_library_or_component(LIB_NAME # INCLUDE_DIR @@ -1577,7 +1597,7 @@ macro(gz_add_executable _name) endmacro() ################################################# -# ign_target_interface_include_directories( [include_targets]) +# gz_target_interface_include_directories( [include_targets]) # # Add the INTERFACE_INCLUDE_DIRECTORIES of [include_targets] to the public # INCLUDE_DIRECTORIES of . This allows us to propagate the include @@ -1586,6 +1606,12 @@ endmacro() # You MUST pass in targets to include, not directory names. We must not use # explicit directory names here if we want our package to be relocatable. function(ign_target_interface_include_directories name) + # TODO(chapulina) Enable warnings after all libraries have migrated. + # message(WARNING "ign_target_interface_include_directories is deprecated, use gz_target_interface_include_directories instead.") + + gz_target_interface_include_directories(name) +endfunction() +function(gz_target_interface_include_directories name) foreach(include_target ${ARGN}) target_include_directories( @@ -1643,7 +1669,7 @@ macro(_gz_filter_valid_compiler_options var) endmacro() ################################################# -# ign_build_executables(SOURCES +# gz_build_executables(SOURCES # [PREFIX ] # [LIB_DEPS ] # [INCLUDE_DIRS ] @@ -1675,21 +1701,38 @@ endmacro() # into your executable's directory. # macro(ign_build_executables) + # TODO(chapulina) Enable warnings after all libraries have migrated. + # message(WARNING "ign_build_executables is deprecated, use gz_build_executables instead.") - #------------------------------------ - # Define the expected arguments set(options EXCLUDE_PROJECT_LIB) set(oneValueArgs PREFIX EXEC_LIST) set(multiValueArgs SOURCES LIB_DEPS INCLUDE_DIRS) - if(gz_build_executables_EXEC_LIST) set(${gz_build_executables_EXEC_LIST} "") endif() + _gz_cmake_parse_arguments(gz_build_executables "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + set(gz_build_executables_skip_parsing true) + gz_build_executables(${PACKAGE_NAME}) +endmacro() +macro(gz_build_executables) - #------------------------------------ - # Parse the arguments - _gz_cmake_parse_arguments(gz_build_executables "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + # Deprecated, remove skip parsing logic in version 4 + if (NOT gz_build_executables_skip_parsing) + #------------------------------------ + # Define the expected arguments + set(options EXCLUDE_PROJECT_LIB) + set(oneValueArgs PREFIX EXEC_LIST) + set(multiValueArgs SOURCES LIB_DEPS INCLUDE_DIRS) + + if(gz_build_executables_EXEC_LIST) + set(${gz_build_executables_EXEC_LIST} "") + endif() + + #------------------------------------ + # Parse the arguments + _gz_cmake_parse_arguments(gz_build_executables "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + endif() foreach(exec_file ${gz_build_executables_SOURCES}) @@ -1808,14 +1851,14 @@ macro(gz_build_tests) endif() if(NOT gz_build_tests_EXCLUDE_PROJECT_LIB) - ign_build_executables( + gz_build_executables( PREFIX "${TEST_TYPE}_" SOURCES ${gz_build_tests_SOURCES} LIB_DEPS gtest gtest_main ${gz_build_tests_LIB_DEPS} INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/test/gtest/include ${gz_build_tests_INCLUDE_DIRS} EXEC_LIST test_list) else() - ign_build_executables( + gz_build_executables( PREFIX "${TEST_TYPE}_" SOURCES ${gz_build_tests_SOURCES} LIB_DEPS gtest gtest_main ${gz_build_tests_LIB_DEPS} diff --git a/cmake/ignition-component-config.cmake.in b/cmake/ignition-component-config.cmake.in index 176809ba..5a224e85 100644 --- a/cmake/ignition-component-config.cmake.in +++ b/cmake/ignition-component-config.cmake.in @@ -111,4 +111,4 @@ set(@component_pkg_name@_LIBRARY @import_target_name@) # This macro is used by ignition-cmake to automatically configure the pkgconfig # files for ignition projects. -ign_pkg_config_entry(@component_pkg_name@ "@component_pkg_name@") +gz_pkg_config_entry(@component_pkg_name@ "@component_pkg_name@") diff --git a/cmake/ignition-config.cmake.in b/cmake/ignition-config.cmake.in index d8246a62..0768c0ed 100644 --- a/cmake/ignition-config.cmake.in +++ b/cmake/ignition-config.cmake.in @@ -145,7 +145,7 @@ set(@LEGACY_PROJECT_PREFIX@_INCLUDE_DIRS ${@PKG_NAME@_INCLUDE_DIRS}) # This macro is used by ignition-cmake to automatically configure the pkgconfig # files for ignition projects. -ign_pkg_config_entry(@PKG_NAME@ "@PKG_NAME@") +gz_pkg_config_entry(@PKG_NAME@ "@PKG_NAME@") # Find each of the components requested by find_package(~) foreach(component ${@PKG_NAME@_FIND_COMPONENTS}) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 90abd1ac..de4d5e1b 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -192,7 +192,7 @@ if (UNIX) @ONLY) set(_env_vars) # On Debian and if the install prefix is /usr, the default CMAKE_INSTALL_LIBDIR of this project - # as set by GNUInstallDirs will be different from the one of the example project, + # as set by GNUInstallDirs will be different from the one of the example project, # so let's hardcode it in that case if(EXISTS "/etc/debian_version" AND "${CMAKE_INSTALL_PREFIX}" MATCHES "^/usr/?$") set(example_PKGCONFIG_INSTALL_LIBDIR "lib/pkgconfig") diff --git a/examples/comp_deps/child/CMakeLists.txt b/examples/comp_deps/child/CMakeLists.txt index 657fb934..e7c94679 100644 --- a/examples/comp_deps/child/CMakeLists.txt +++ b/examples/comp_deps/child/CMakeLists.txt @@ -1,5 +1,5 @@ -ign_add_component(child INTERFACE +gz_add_component(child INTERFACE DEPENDS_ON_COMPONENTS parent GET_TARGET_NAME child) diff --git a/examples/comp_deps/parent/CMakeLists.txt b/examples/comp_deps/parent/CMakeLists.txt index 793f7ea1..f38ec3c1 100644 --- a/examples/comp_deps/parent/CMakeLists.txt +++ b/examples/comp_deps/parent/CMakeLists.txt @@ -1,5 +1,5 @@ -ign_add_component(parent INTERFACE +gz_add_component(parent INTERFACE GET_TARGET_NAME parent) install(