Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate ign_configure_project, ign_*_executable, ign_import_target #257

Merged
merged 11 commits into from
May 24, 2022
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ include(IgnCMake)

#--------------------------------------
# Set up the project
ign_configure_project(VERSION_SUFFIX pre1)
gz_configure_project(VERSION_SUFFIX pre1)

#--------------------------------------
# Set project-specific options
Expand Down
4 changes: 2 additions & 2 deletions MigrationFromClassic.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ now taking advantage of.

This will find `ignition-cmake` and load up all its useful features for you.

### Then call `ign_configure_project(<project> <version>)`
### Then call `gz_configure_project(<project> <version>)`

This is a wrapper for cmake's native `project(~)` command which additionally
sets a bunch of variables that will be needed by the `ignition-cmake` macros and
Expand Down Expand Up @@ -214,7 +214,7 @@ using `::` in the names of any imported targets that we intend to use.
`ignition-cmake` will automatically export all ignition library targets to have
the name `ignition-<project><major_version>::ignition-<project><major_version>`
(for example, `ignition-common0::ignition-common0`). When creating a cmake
find-module, the macro `ign_import_target(~)` should be used generate an
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.

Expand Down
2 changes: 1 addition & 1 deletion cmake/FindCPPZMQ.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ if(CPPZMQ_FOUND)

# Since this is a header-only library, we should import it as an INTERFACE
# target.
ign_import_target(CPPZMQ INTERFACE)
gz_import_target(CPPZMQ INTERFACE)

# Now, to use the CPPZMQ headers, you should call
# target_link_libraries(<tgt> CPPZMQ::CPPZMQ) instead of using
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindDL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ else()

if(DL_FOUND)
include(IgnImportTarget)
ign_import_target(DL)
gz_import_target(DL)
set(DL_TARGET DL::DL)
endif()

Expand Down
4 changes: 2 additions & 2 deletions cmake/FindEIGEN3.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ if(EIGEN3_FOUND)
# Attempt to create an imported target in case we're using an old version
# of Eigen. (This function skip creating the imported target if it already
# exists).
ign_import_target(EIGEN3 INTERFACE
gz_import_target(EIGEN3 INTERFACE
TARGET_NAME Eigen3::Eigen)

if(EIGEN3_FIND_VERSION)
Expand Down Expand Up @@ -68,7 +68,7 @@ if(MSVC)
endif()
endif()

ign_import_target(EIGEN3 INTERFACE
gz_import_target(EIGEN3 INTERFACE
TARGET_NAME Eigen3::Eigen)

endif()
4 changes: 2 additions & 2 deletions cmake/FindFreeImage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ if (NOT WIN32)
if(FreeImage_FOUND)
# Create the imported target for FreeImage if we found it
include(IgnImportTarget)
ign_import_target(FreeImage)
gz_import_target(FreeImage)
endif()

include(FindPackageHandleStandardArgs)
Expand Down Expand Up @@ -143,7 +143,7 @@ else()
include(IgnPkgConfig)
ign_pkg_config_library_entry(FreeImage "FreeImage")
include(IgnImportTarget)
ign_import_target(FreeImage)
gz_import_target(FreeImage)
endif()

endif()
2 changes: 1 addition & 1 deletion cmake/FindGTS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,6 @@ else()
include(IgnPkgConfig)
ign_pkg_config_library_entry(GTS gts)
include(IgnImportTarget)
ign_import_target(GTS)
gz_import_target(GTS)
endif()
endif()
2 changes: 1 addition & 1 deletion cmake/FindIFADDRS.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ if(IFADDRS_FOUND)

# Since this is a header-only library, we should import it as an INTERFACE
# target.
ign_import_target(IFADDRS INTERFACE)
gz_import_target(IFADDRS INTERFACE)

endif()

Expand Down
2 changes: 1 addition & 1 deletion cmake/FindIgnBullet.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ set(IgnBullet_FOUND false)
if(BULLET_FOUND)
set(IgnBullet_FOUND true)

ign_import_target(IgnBullet
gz_import_target(IgnBullet
TARGET_NAME IgnBullet::IgnBullet
LIB_VAR BULLET_LIBRARIES
INCLUDE_VAR BULLET_INCLUDE_DIRS
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindIgnCURL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ if(${IgnCURL_FOUND})
include(IgnImportTarget)

if(NOT TARGET curl::curl)
ign_import_target(curl
gz_import_target(curl
LIB_VAR CURL_LIBRARIES
INCLUDE_VAR CURL_INCLUDE_DIRS)
endif()
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindIgnOGRE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ if(OGRE_FOUND)
endforeach()

include(IgnImportTarget)
ign_import_target(IgnOGRE
gz_import_target(IgnOGRE
TARGET_NAME IgnOGRE::IgnOGRE
LIB_VAR OGRE_LIBRARIES
INCLUDE_VAR OGRE_INCLUDE_DIRS)
Expand Down
6 changes: 3 additions & 3 deletions cmake/FindIgnOGRE2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ if (NOT WIN32)

set(component_LIBRARY_DIRS ${OGRE2_LIBRARY_DIRS})
set(component_LIBRARIES ${OGRE2-${component}})
ign_import_target(${component} TARGET_NAME ${component_TARGET_NAME}
gz_import_target(${component} TARGET_NAME ${component_TARGET_NAME}
LIB_VAR component_LIBRARIES
INCLUDE_VAR component_INCLUDE_DIRS)

Expand Down Expand Up @@ -482,7 +482,7 @@ else() #WIN32

set(component_LIBRARIES ${${PREFIX}_LIBRARIES})

ign_import_target(${component}
gz_import_target(${component}
TARGET_NAME ${component_TARGET_NAME}
LIB_VAR component_LIBRARIES
INCLUDE_VAR component_INCLUDE_DIRS
Expand All @@ -505,7 +505,7 @@ set(IgnOGRE2_FOUND false)
if (OGRE2_FOUND)
set(IgnOGRE2_FOUND true)

ign_import_target(IgnOGRE2
gz_import_target(IgnOGRE2
TARGET_NAME IgnOGRE2::IgnOGRE2
LIB_VAR OGRE2_LIBRARIES
INCLUDE_VAR OGRE2_INCLUDE_DIRS)
Expand Down
4 changes: 2 additions & 2 deletions cmake/FindIgnProtobuf.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,14 @@ if(${Protobuf_FOUND})
include(IgnImportTarget)

if(NOT TARGET protobuf::libprotobuf)
ign_import_target(protobuf
gz_import_target(protobuf
TARGET_NAME protobuf::libprotobuf
LIB_VAR PROTOBUF_LIBRARY
INCLUDE_VAR PROTOBUF_INCLUDE_DIR)
endif()

if(NOT TARGET protobuf::libprotoc)
ign_import_target(protobuf
gz_import_target(protobuf
TARGET_NAME protobuf::libprotoc
LIB_VAR PROTOBUF_PROTOC_LIBRARY
INCLUDE_VAR PROTOBUF_INCLUDE_DIR)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindJSONCPP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ else()

if(JSONCPP_FOUND)
include(IgnImportTarget)
ign_import_target(JSONCPP)
gz_import_target(JSONCPP)
endif()
endif()
include(FindPackageHandleStandardArgs)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindODE.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ if(ODE_FOUND)
endif()

include(IgnImportTarget)
ign_import_target(ODE)
gz_import_target(ODE)

if(NOT ODE_FIND_QUIETLY)
message(STATUS "Found ODE: ${ODE_LIBRARIES}")
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindSQLite3.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ if(MSVC)
endif()
endif()

ign_import_target(SQLite3)
gz_import_target(SQLite3)

endif()
2 changes: 1 addition & 1 deletion cmake/FindTINYXML2.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ if(NOT TINYXML2_FOUND)

if(TINYXML2_FOUND)
include(IgnImportTarget)
ign_import_target(TINYXML2)
gz_import_target(TINYXML2)
endif()

include(FindPackageHandleStandardArgs)
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindYAML.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ else()

if(YAML_FOUND)
include(IgnImportTarget)
ign_import_target(YAML)
gz_import_target(YAML)
message(STATUS "Assuming libyaml is static, defining YAML_DECLARE_STATIC")
set_target_properties(YAML::YAML PROPERTIES
INTERFACE_COMPILE_DEFINITIONS "YAML_DECLARE_STATIC"
Expand Down
2 changes: 1 addition & 1 deletion cmake/FindZIP.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ if(NOT ZIP_FOUND)

if(ZIP_FOUND)
include(IgnImportTarget)
ign_import_target(ZIP)
gz_import_target(ZIP)
endif()
endif()

Expand Down
34 changes: 27 additions & 7 deletions cmake/IgnConfigureProject.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# IgnConfigureProject
# -------------------
#
# ign_configure_project([VERSION_SUFFIX <pre|alpha|beta|etc>])
# gz_configure_project([VERSION_SUFFIX <pre|alpha|beta|etc>])
#
# Sets up an ignition library project.
#
Expand Down Expand Up @@ -31,17 +31,32 @@
#################################################
# Initialize the ignition project
macro(ign_configure_project)
# TODO(chapulina) Enable warnings after all libraries have migrated.
# message(WARNING "ign_configure_project is deprecated, use gz_configure_project instead.")

#------------------------------------
# Define the expected arguments
set(options NO_IGNITION_PREFIX)
set(oneValueArgs REPLACE_IGNITION_INCLUDE_PATH VERSION_SUFFIX)
set(multiValueArgs) # We are not using multiValueArgs yet

#------------------------------------
# Parse the arguments
_gz_cmake_parse_arguments(gz_configure_project "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

set(gz_configure_project_skip_parsing true)
gz_configure_project()
endmacro()
macro(gz_configure_project)

# Deprecated, remove skip parsing logic in version 4
if (NOT gz_configure_project_skip_parsing)
#------------------------------------
# Define the expected arguments
set(options NO_IGNITION_PREFIX)
set(oneValueArgs REPLACE_IGNITION_INCLUDE_PATH VERSION_SUFFIX)
set(multiValueArgs) # We are not using multiValueArgs yet

#------------------------------------
# Parse the arguments
_gz_cmake_parse_arguments(gz_configure_project "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
endif()

# Note: The following are automatically defined by project(~) in cmake v3:
# PROJECT_NAME
# PROJECT_VERSION_MAJOR
Expand Down Expand Up @@ -120,7 +135,7 @@ macro(ign_configure_project)

#============================================================================
# Identify the operating system
ign_check_os()
gz_check_os()

#============================================================================
# Create package information
Expand Down Expand Up @@ -182,6 +197,11 @@ endmacro()
#################################################
# Check the OS type.
macro(ign_check_os)
# TODO(chapulina) Enable warnings after all libraries have migrated.
# message(WARNING "ign_check_os is deprecated, use gz_check_os instead.")
gz_check_os()
endmacro()
macro(gz_check_os)

# CMake does not distinguish Linux from other Unices.
string(REGEX MATCH "Linux" PLAYER_OS_LINUX ${CMAKE_SYSTEM_NAME})
Expand Down
26 changes: 20 additions & 6 deletions cmake/IgnImportTarget.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
# limitations under the License.
#
########################################
# ign_import_target(<package> [INTERFACE]
# gz_import_target(<package> [INTERFACE]
# [TARGET_NAME <target_name>]
# [LIB_VAR <library_variable>]
# [INCLUDE_VAR <header_directory_variable>]
Expand Down Expand Up @@ -44,17 +44,31 @@
# this package. Default is <package>_CFLAGS.
#
macro(ign_import_target package)
# TODO(chapulina) Enable warnings after all libraries have migrated.
# message(WARNING "ign_import_target is deprecated, use gz_import_target instead.")

#------------------------------------
# Define the expected arguments
set(options "INTERFACE")
set(oneValueArgs "TARGET_NAME" "LIB_VAR" "INCLUDE_VAR" "CFLAGS_VAR")
set(multiValueArgs) # We are not using multiValueArgs yet

#------------------------------------
# Parse the arguments
_gz_cmake_parse_arguments(gz_import_target "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

set(gz_import_target_skip_parsing true)
gz_import_target(${package})
endmacro()
macro(gz_import_target package)

if (NOT gz_import_target_skip_parsing)
#------------------------------------
# Define the expected arguments
set(options "INTERFACE")
set(oneValueArgs "TARGET_NAME" "LIB_VAR" "INCLUDE_VAR" "CFLAGS_VAR")
set(multiValueArgs) # We are not using multiValueArgs yet

#------------------------------------
# Parse the arguments
_gz_cmake_parse_arguments(gz_import_target "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
endif()

#------------------------------------
# Check if a target name has been provided, otherwise use
# ${package}::{$package} as the target name.
Expand Down
2 changes: 1 addition & 1 deletion cmake/IgnManualSearch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ macro(gz_manual_search PACKAGE_NAME)

if(${package}_FOUND)
include(IgnImportTarget)
ign_import_target(${package} ${_gz_pkg_check_modules_interface_option}
gz_import_target(${package} ${_gz_pkg_check_modules_interface_option}
TARGET_NAME ${ign_pkg_check_modules_TARGET_NAME})
endif()

Expand Down
2 changes: 1 addition & 1 deletion cmake/IgnPkgConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ macro(ign_pkg_check_modules_quiet package signature)
"${${package}_LIBRARY_DIRS}")

include(IgnImportTarget)
ign_import_target(${package} ${_gz_pkg_check_modules_interface_option}
gz_import_target(${package} ${_gz_pkg_check_modules_interface_option}
TARGET_NAME ${gz_pkg_check_modules_TARGET_NAME})

endif()
Expand Down
15 changes: 15 additions & 0 deletions cmake/IgnUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -1516,6 +1516,11 @@ endmacro()

#################################################
macro(ign_add_executable _name)
# TODO(chapulina) Enable warnings after all libraries have migrated.
# message(WARNING "ign_add_executable is deprecated, use gz_add_executable instead.")
gz_add_executable(${_name} ${ARGN})
endmacro()
macro(gz_add_executable _name)
add_executable(${_name} ${ARGN})
target_link_libraries(${_name} ${general_libraries})
endmacro()
Expand All @@ -1541,12 +1546,22 @@ endfunction()

#################################################
macro(ign_install_includes _subdir)
# TODO(chapulina) Enable warnings after all libraries have migrated.
# message(WARNING "ign_install_includes is deprecated, use gz_install_includes instead.")
gz_install_includes(${_subdir} ${ARGN})
endmacro()
macro(gz_install_includes _subdir)
install(FILES ${ARGN}
DESTINATION ${IGN_INCLUDE_INSTALL_DIR}/${_subdir} COMPONENT headers)
endmacro()

#################################################
macro(ign_install_executable _name )
# TODO(chapulina) Enable warnings after all libraries have migrated.
# message(WARNING "ign_install_executable is deprecated, use gz_install_executable instead.")
gz_install_executable(${_name} ${ARGN})
endmacro()
macro(gz_install_executable _name)
set_target_properties(${_name} PROPERTIES VERSION ${PROJECT_VERSION_FULL})
install (TARGETS ${_name} DESTINATION ${IGN_BIN_INSTALL_DIR})
manpage(${_name} 1)
Expand Down
2 changes: 1 addition & 1 deletion examples/comp_deps/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
project(ignition-component_deps VERSION 0.1.0)
find_package(ignition-cmake3 REQUIRED)
ign_configure_project()
gz_configure_project()
gz_configure_build(QUIT_IF_BUILD_ERRORS
COMPONENTS child parent)
gz_create_packages()
Expand Down
Loading