Skip to content

Commit

Permalink
Migrate configurable file references (#274)
Browse files Browse the repository at this point in the history
Signed-off-by: methylDragon <[email protected]>
  • Loading branch information
methylDragon committed Jul 9, 2022
1 parent c0e1680 commit 442a410
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 26 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ install(DIRECTORY tools/

#--------------------------------------
# Create configuration and installation variables
set(gz_config_input "${CMAKE_CURRENT_SOURCE_DIR}/config/ignition-cmake-config.cmake.in")
set(gz_config_input "${CMAKE_CURRENT_SOURCE_DIR}/config/gz-cmake-config.cmake.in")
set(gz_config_output "${PROJECT_NAME_LOWER}-config.cmake")
set(gz_version_output "${PROJECT_NAME_LOWER}-config-version.cmake")
set(gz_config_install_dir "${CMAKE_INSTALL_DATAROOTDIR}/cmake/${PROJECT_NAME_LOWER}")
set(ign_pkgconfig_input "${CMAKE_CURRENT_SOURCE_DIR}/config/ignition-cmake.pc.in")
set(ign_pkgconfig_input "${CMAKE_CURRENT_SOURCE_DIR}/config/gz-cmake-config.cmake.in")
set(ign_pkgconfig_output "${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc")
set(ign_pkgconfig_install_dir "${IGN_LIB_INSTALL_DIR}/pkgconfig")
set(ign_utilities_target ${PROJECT_EXPORT_NAME}-utilities)
Expand Down
18 changes: 9 additions & 9 deletions cmake/GzPackaging.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ endmacro()
# gz_add_component(~), so users of gz-cmake should not call this
# function.
#
# NOTE: For gz-cmake developers, the variables needed by ignition.pc.in or
# ignition-component.pc.in MUST be set before calling this function.
# NOTE: For gz-cmake developers, the variables needed by gz.pc.in or
# gz-component.pc.in MUST be set before calling this function.
#
# Create a pkgconfig file for your target, and install it.
function(_gz_create_pkgconfig)
Expand All @@ -197,10 +197,10 @@ function(_gz_create_pkgconfig)
#------------------------------------
# Choose which input file to use
if(_gz_create_pkgconfig_COMPONENT)
set(pkgconfig_input "${IGNITION_CMAKE_DIR}/pkgconfig/ignition-component.pc.in")
set(pkgconfig_input "${IGNITION_CMAKE_DIR}/pkgconfig/gz-component.pc.in")
set(target_name ${PROJECT_LIBRARY_TARGET_NAME}-${_gz_create_pkgconfig_COMPONENT})
else()
set(pkgconfig_input "${IGNITION_CMAKE_DIR}/pkgconfig/ignition.pc.in")
set(pkgconfig_input "${IGNITION_CMAKE_DIR}/pkgconfig/gz.pc.in")
set(target_name ${PROJECT_LIBRARY_TARGET_NAME})
endif()

Expand Down Expand Up @@ -239,7 +239,7 @@ endfunction()
# function.
#
# NOTE: For gz-cmake developers, some of the variables needed by
# ignition-config.cmake.in or ignition-component-config.cmake.in MUST be
# gz-config.cmake.in or gz-component-config.cmake.in MUST be
# set before calling this function. The following variables are set
# automatically by this function:
# - import_target_name
Expand Down Expand Up @@ -270,20 +270,20 @@ function(_gz_create_cmake_package)

set(component ${_gz_create_cmake_package_COMPONENT})
set(target_name ${PROJECT_LIBRARY_TARGET_NAME}-${component})
set(gz_config_input "${IGNITION_CMAKE_DIR}/ignition-component-config.cmake.in")
set(gz_config_input "${IGNITION_CMAKE_DIR}/gz-component-config.cmake.in")
set(simple_import_name ${component})

elseif(_gz_create_cmake_package_ALL)

set(gz_config_input "${IGNITION_CMAKE_DIR}/ignition-all-config.cmake.in")
set(gz_config_input "${IGNITION_CMAKE_DIR}/gz-all-config.cmake.in")
set(target_name ${PROJECT_LIBRARY_TARGET_NAME}-all)
set(all_pkg_name ${PROJECT_LIBRARY_TARGET_NAME}-all)
set(simple_import_name all)

else()

set(target_name ${PROJECT_LIBRARY_TARGET_NAME})
set(gz_config_input "${IGNITION_CMAKE_DIR}/ignition-config.cmake.in")
set(gz_config_input "${IGNITION_CMAKE_DIR}/gz-config.cmake.in")
set(simple_import_name core)

endif()
Expand All @@ -298,7 +298,7 @@ function(_gz_create_cmake_package)

endif()

# This gets used by the ignition-*.config.cmake.in files
# This gets used by the gz-*.config.cmake.in files
set(target_output_filename ${target_name}-targets.cmake)
set(gz_config_output "${PROJECT_BINARY_DIR}/cmake/${target_name}-config.cmake")
set(gz_version_output "${PROJECT_BINARY_DIR}/cmake/${target_name}-config-version.cmake")
Expand Down
12 changes: 6 additions & 6 deletions cmake/GzUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ endfunction()
# ${IGN_DESIGNATION}.hh. This will only add them to the header, it will not
# generate or install them.
#
# This will also run configure_file on ign_auto_headers.hh.in and config.hh.in
# This will also run configure_file on gz_auto_headers.hh.in and config.hh.in
# and install them. This will NOT install any other files or directories that
# appear in the ${CMAKE_CURRENT_BINARY_DIR}.
#
Expand Down Expand Up @@ -821,7 +821,7 @@ function(gz_install_all_headers)
set(meta_header_install_dir ${IGN_INCLUDE_INSTALL_DIR_FULL}/${PROJECT_INCLUDE_DIR}/${component_name})

# Define the input/output of the configuration for the component "master" header
set(master_header_in ${IGNITION_CMAKE_DIR}/ign_auto_headers.hh.in)
set(master_header_in ${IGNITION_CMAKE_DIR}/gz_auto_headers.hh.in)
set(master_header_out ${CMAKE_CURRENT_BINARY_DIR}/${component_name}.hh)

else()
Expand All @@ -830,7 +830,7 @@ function(gz_install_all_headers)
set(meta_header_install_dir ${IGN_INCLUDE_INSTALL_DIR_FULL}/${PROJECT_INCLUDE_DIR})

# Define the input/output of the configuration for the core "master" header
set(master_header_in ${IGNITION_CMAKE_DIR}/ign_auto_headers.hh.in)
set(master_header_in ${IGNITION_CMAKE_DIR}/gz_auto_headers.hh.in)
set(master_header_out ${CMAKE_CURRENT_BINARY_DIR}/../${IGN_DESIGNATION}.hh)

endif()
Expand Down Expand Up @@ -1377,7 +1377,7 @@ function(gz_add_component component_name)
endif()

#------------------------------------
# Set variables that are needed by cmake/ignition-component-config.cmake.in
# Set variables that are needed by cmake/gz-component-config.cmake.in
set(component_pkg_name ${component_target_name})
if(gz_add_component_INTERFACE)
set(component_pkgconfig_lib)
Expand All @@ -1389,7 +1389,7 @@ function(gz_add_component component_name)
# variable is used in config files
set(component_name ${component_name})

# ... and by cmake/pkgconfig/ignition-component.pc.in
# ... and by cmake/pkgconfig/gz-component.pc.in
set(component_pkgconfig_requires ${${component_name}_PKGCONFIG_REQUIRES})
set(component_pkgconfig_requires_private ${${component_name}_PKGCONFIG_REQUIRES_PRIVATE})
set(component_pkgconfig_lib_deps ${${component_name}_PKGCONFIG_LIBS})
Expand Down Expand Up @@ -1437,7 +1437,7 @@ endfunction()
# Exports the `all` target. This function is private to gz-cmake.
function(_gz_export_target_all)

# find_all_pkg_components is used as a variable in ignition-all-config.cmake.in
# find_all_pkg_components is used as a variable in gz-all-config.cmake.in
set(find_all_pkg_components "")
get_property(all_known_components TARGET ${PROJECT_LIBRARY_TARGET_NAME}-all
PROPERTY INTERFACE_IGN_ALL_KNOWN_COMPONENTS)
Expand Down
2 changes: 1 addition & 1 deletion cmake/gz_auto_headers.hh.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

// ****** Do not modify this file. ******
// This file is automatically generated by CMake. Changes should instead be
// made to cmake/ign_auto_headers.hh.in in gz-cmake
// made to cmake/gz_auto_headers.hh.in in gz-cmake

#include <@PROJECT_INCLUDE_DIR@/config.hh>
${ign_headers}
16 changes: 8 additions & 8 deletions test/cmake_minimum_required.bash
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@

export CMAKE_FILES_TO_CHECK="
$1/CMakeLists.txt
$1/cmake/ignition-all-config.cmake.in
$1/cmake/ignition-component-config.cmake.in
$1/cmake/ignition-config.cmake.in
$1/config/ignition-cmake-config.cmake.in"
$1/cmake/gz-all-config.cmake.in
$1/cmake/gz-component-config.cmake.in
$1/cmake/gz-config.cmake.in
$1/config/gz-cmake-config.cmake.in"
unset TEST_CMAKE_MIN_REQUIRED_FAILED
# first argument is root of gz-cmake repository
if [[ ! -d "$1" \
|| ! -a "$1/CMakeLists.txt" \
|| ! -a "$1/cmake/ignition-all-config.cmake.in" \
|| ! -a "$1/cmake/ignition-component-config.cmake.in" \
|| ! -a "$1/cmake/ignition-config.cmake.in" \
|| ! -a "$1/config/ignition-cmake-config.cmake.in" ]]; then
|| ! -a "$1/cmake/gz-all-config.cmake.in" \
|| ! -a "$1/cmake/gz-component-config.cmake.in" \
|| ! -a "$1/cmake/gz-config.cmake.in" \
|| ! -a "$1/config/gz-cmake-config.cmake.in" ]]; then
echo the first argument must be the root of the gz-cmake repository
export TEST_CMAKE_MIN_REQUIRED_FAILED=1
else
Expand Down

0 comments on commit 442a410

Please sign in to comment.