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

[ign ➡️ gz] Internal parsed variables #245

Merged
merged 4 commits into from
May 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions cmake/IgnCodeCoverage.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@ FUNCTION(ign_setup_target_for_coverage)

#------------------------------------
# Parse the arguments
_ign_cmake_parse_arguments(ign_coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
_ign_cmake_parse_arguments(gz_coverage "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

set(_outputname ${ign_coverage_OUTPUT_NAME})
set(_targetname ${ign_coverage_TARGET_NAME})
set(_testrunner ${ign_coverage_TEST_RUNNER})
set(_outputname ${gz_coverage_OUTPUT_NAME})
set(_targetname ${gz_coverage_TARGET_NAME})
set(_testrunner ${gz_coverage_TEST_RUNNER})

if(ign_coverage_BRANCH_COVERAGE)
if(gz_coverage_BRANCH_COVERAGE)
set(_branch_flags --rc lcov_branch_coverage=1)
endif()

Expand Down
14 changes: 7 additions & 7 deletions cmake/IgnConfigureBuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ macro(ign_configure_build)
set(options HIDE_SYMBOLS_BY_DEFAULT QUIT_IF_BUILD_ERRORS)
set(oneValueArgs)
set(multiValueArgs COMPONENTS)
cmake_parse_arguments(ign_configure_build "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
cmake_parse_arguments(gz_configure_build "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

#============================================================================
# Examine the build type. If we do not recognize the type, we will generate
Expand Down Expand Up @@ -64,7 +64,7 @@ macro(ign_configure_build)

set(error_str "Errors encountered in build. Please see BUILD ERRORS above.")

if(ign_configure_build_QUIT_IF_BUILD_ERRORS)
if(gz_configure_build_QUIT_IF_BUILD_ERRORS)
message(FATAL_ERROR "${error_str}")
else()
message(WARNING "${error_str}")
Expand Down Expand Up @@ -135,7 +135,7 @@ macro(ign_configure_build)
# We treat "core" the same way as we treat the component subdirectories.
# It's inserted into the beginning of the list to make sure that the core
# subdirectory is handled before any other.
list(INSERT ign_configure_build_COMPONENTS 0 core)
list(INSERT gz_configure_build_COMPONENTS 0 core)

else()

Expand Down Expand Up @@ -191,7 +191,7 @@ macro(ign_configure_build)

#--------------------------------------
# Add the source code directories of each component if they exist
foreach(component ${ign_configure_build_COMPONENTS})
foreach(component ${gz_configure_build_COMPONENTS})

if(NOT SKIP_${component} AND NOT INTERNAL_SKIP_${component})

Expand Down Expand Up @@ -306,14 +306,14 @@ function(_ign_find_include_script)

#------------------------------------
# Parse the arguments
cmake_parse_arguments(_ign_find_include_script "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
cmake_parse_arguments(_gz_find_include_script "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

#------------------------------------
# Set the starting point
set(include_start "${CMAKE_CURRENT_LIST_DIR}")

if(_ign_find_include_script_COMPONENT)
ign_string_append(include_start ${_ign_find_include_script_COMPONENT} DELIM "/")
if(_gz_find_include_script_COMPONENT)
ign_string_append(include_start ${_gz_find_include_script_COMPONENT} DELIM "/")
endif()

# Check each level of depth to find the first CMakeLists.txt. This allows us
Expand Down
12 changes: 6 additions & 6 deletions cmake/IgnConfigureProject.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ macro(ign_configure_project)

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

# Note: The following are automatically defined by project(~) in cmake v3:
# PROJECT_NAME
# PROJECT_VERSION_MAJOR
# PROJECT_VERSION_MINOR
# PROJECT_VERSION_PATCH

if(ign_configure_project_VERSION_SUFFIX)
set(PROJECT_VERSION_SUFFIX ${ign_configure_project_VERSION_SUFFIX})
if(gz_configure_project_VERSION_SUFFIX)
set(PROJECT_VERSION_SUFFIX ${gz_configure_project_VERSION_SUFFIX})
endif()

#============================================================================
Expand All @@ -72,7 +72,7 @@ macro(ign_configure_project)
# Set project variables
#============================================================================

if(ign_configure_project_NO_IGNITION_PREFIX)
if(gz_configure_project_NO_IGNITION_PREFIX)
set(PROJECT_NAME_NO_VERSION ${IGN_DESIGNATION})
else()
set(PROJECT_NAME_NO_VERSION "${PROJECT_PREFIX}-${IGN_DESIGNATION}")
Expand All @@ -92,8 +92,8 @@ macro(ign_configure_project)
set(PROJECT_EXPORT_NAME ${PROJECT_NAME_LOWER})
set(PROJECT_LIBRARY_TARGET_NAME ${PROJECT_NAME_LOWER})

if(ign_configure_project_REPLACE_IGNITION_INCLUDE_PATH)
set(PROJECT_INCLUDE_DIR ${ign_configure_project_REPLACE_IGNITION_INCLUDE_PATH})
if(gz_configure_project_REPLACE_IGNITION_INCLUDE_PATH)
set(PROJECT_INCLUDE_DIR ${gz_configure_project_REPLACE_IGNITION_INCLUDE_PATH})
else()
set(PROJECT_INCLUDE_DIR ignition/${IGN_DESIGNATION})
endif()
Expand Down
14 changes: 7 additions & 7 deletions cmake/IgnCreateDocs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function(ign_create_docs)

#------------------------------------
# Parse the arguments
_ign_cmake_parse_arguments(ign_create_docs "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
_ign_cmake_parse_arguments(gz_create_docs "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

set(required_html_files
"doxygen/html/annotated.html"
Expand Down Expand Up @@ -117,26 +117,26 @@ function(ign_create_docs)
include(IgnRonn2Man)
ign_add_manpage_target()

set(IGNITION_DOXYGEN_API_MAINPAGE_MD ${ign_create_docs_API_MAINPAGE_MD})
set(IGNITION_DOXYGEN_AUTOGENERATED_DOC ${ign_create_docs_AUTOGENERATED_DOC})
set(IGNITION_DOXYGEN_API_MAINPAGE_MD ${gz_create_docs_API_MAINPAGE_MD})
set(IGNITION_DOXYGEN_AUTOGENERATED_DOC ${gz_create_docs_AUTOGENERATED_DOC})
set(IGNITION_DOXYGEN_TUTORIALS_MAINPAGE_MD
${ign_create_docs_TUTORIALS_MAINPAGE_MD})
${gz_create_docs_TUTORIALS_MAINPAGE_MD})

set(IGNITION_DOXYGEN_TAGFILES " ")

foreach(tagfile ${ign_create_docs_TAGFILES})
foreach(tagfile ${gz_create_docs_TAGFILES})
ign_string_append(IGNITION_DOXYGEN_TAGFILES "\"${tagfile}\"" DELIM " \\\\\\\\\n ")
endforeach()

set(IGNITION_DOXYGEN_ADDITIONAL_INPUT_DIRS " ")

foreach(dir ${ign_create_docs_ADDITIONAL_INPUT_DIRS})
foreach(dir ${gz_create_docs_ADDITIONAL_INPUT_DIRS})
ign_string_append(IGNITION_DOXYGEN_ADDITIONAL_INPUT_DIRS "${dir}")
endforeach()

set(IGNITION_DOXYGEN_IMAGE_PATH " ")

foreach(dir ${ign_create_docs_IMAGE_PATH_DIRS})
foreach(dir ${gz_create_docs_IMAGE_PATH_DIRS})
ign_string_append(IGNITION_DOXYGEN_IMAGE_PATH "${dir}")
endforeach()

Expand Down
42 changes: 21 additions & 21 deletions cmake/IgnImportTarget.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,13 @@ macro(ign_import_target package)

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

#------------------------------------
# Check if a target name has been provided, otherwise use
# ${package}::{$package} as the target name.
if(ign_import_target_TARGET_NAME)
set(target_name ${ign_import_target_TARGET_NAME})
if(gz_import_target_TARGET_NAME)
set(target_name ${gz_import_target_TARGET_NAME})
else()
set(target_name ${package}::${package})
endif()
Expand All @@ -69,66 +69,66 @@ macro(ign_import_target package)
#------------------------------------
# Use default versions of these build variables if custom versions were not
# provided.
if(NOT ign_import_target_LIB_VAR)
set(ign_import_target_LIB_VAR ${package}_LIBRARIES)
if(NOT gz_import_target_LIB_VAR)
set(gz_import_target_LIB_VAR ${package}_LIBRARIES)
endif()

if(NOT ign_import_target_INCLUDE_VAR)
set(ign_import_target_INCLUDE_VAR ${package}_INCLUDE_DIRS)
if(NOT gz_import_target_INCLUDE_VAR)
set(gz_import_target_INCLUDE_VAR ${package}_INCLUDE_DIRS)
endif()

if(NOT ign_import_target_CFLAGS_VAR)
set(ign_import_target_CFLAGS_VAR ${package}_CFLAGS)
if(NOT gz_import_target_CFLAGS_VAR)
set(gz_import_target_CFLAGS_VAR ${package}_CFLAGS)
endif()

#------------------------------------
# Link against this "imported" target by saying
# target_link_libraries(mytarget package::package), instead of linking
# against the variable package_LIBRARIES with the old-fashioned
# target_link_libraries(mytarget ${package_LIBRARIES}
if(NOT ign_import_target_INTERFACE)
if(NOT gz_import_target_INTERFACE)
add_library(${target_name} UNKNOWN IMPORTED)
else()
add_library(${target_name} INTERFACE IMPORTED)
endif()

# Do not bother with the IMPORTED_LOCATION or IMPORTED_IMPLIB variables if it
# is an INTERFACE target.
if(NOT ign_import_target_INTERFACE)
if(NOT gz_import_target_INTERFACE)

if(${ign_import_target_LIB_VAR})
_ign_sort_libraries(${target_name} ${${ign_import_target_LIB_VAR}})
if(${gz_import_target_LIB_VAR})
_ign_sort_libraries(${target_name} ${${gz_import_target_LIB_VAR}})
endif()

endif()

if(${ign_import_target_LIB_VAR})
if(${gz_import_target_LIB_VAR})
set_target_properties(${target_name} PROPERTIES
INTERFACE_LINK_LIBRARIES "${${ign_import_target_LIB_VAR}}")
INTERFACE_LINK_LIBRARIES "${${gz_import_target_LIB_VAR}}")
endif()

if(${ign_import_target_INCLUDE_VAR})
if(${gz_import_target_INCLUDE_VAR})
# TODO: In a later version of cmake, it should be possible to replace this
# with
#
# target_include_directories(${target_name} INTERFACE ${${ign_import_target_INCLUDE_VAR}})
# target_include_directories(${target_name} INTERFACE ${${gz_import_target_INCLUDE_VAR}})
#
# But this will not be possible until we are using whichever version of cmake
# the PR https://gitlab.kitware.com/cmake/cmake/merge_requests/1264
# is available for.
set_property(
TARGET ${target_name}
PROPERTY INTERFACE_INCLUDE_DIRECTORIES
${${ign_import_target_INCLUDE_VAR}})
${${gz_import_target_INCLUDE_VAR}})
endif()

if(${ign_import_target_CFLAGS_VAR})
if(${gz_import_target_CFLAGS_VAR})
# TODO: See note above. We should eventually be able to replace this with
# target_compile_options(${target_name} INTERFACE ${${ign_import_target_CFLAGS_VAR}})
# target_compile_options(${target_name} INTERFACE ${${gz_import_target_CFLAGS_VAR}})
set_property(
TARGET ${target_name}
PROPERTY INTERFACE_COMPILE_OPTIONS
${${ign_import_target_CFLAGS_VAR}})
${${gz_import_target_CFLAGS_VAR}})
endif()

# What about linker flags? Is there no target property for that?
Expand Down
28 changes: 14 additions & 14 deletions cmake/IgnManualSearch.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -51,32 +51,32 @@ macro(ign_manual_search package)

#------------------------------------
# Parse the arguments
_ign_cmake_parse_arguments(ign_manual_search "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
_ign_cmake_parse_arguments(gz_manual_search "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

if(ign_manual_search_INTERFACE)
set(_ign_manual_search_interface_option INTERFACE)
if(gz_manual_search_INTERFACE)
set(_gz_manual_search_interface_option INTERFACE)
else()
set(_ign_manual_search_interface_option) # Intentionally blank
set(_gz_manual_search_interface_option) # Intentionally blank
endif()

if(NOT ign_manual_search_HEADER_NAMES)
set(ign_manual_search_HEADER_NAMES "${package}.h")
if(NOT gz_manual_search_HEADER_NAMES)
set(gz_manual_search_HEADER_NAMES "${package}.h")
endif()

if(NOT ign_manual_search_LIBRARY_NAMES)
set(ign_manual_search_LIBRARY_NAMES "${package}")
if(NOT gz_manual_search_LIBRARY_NAMES)
set(gz_manual_search_LIBRARY_NAMES "${package}")
endif()

if(NOT ign_manual_search_TARGET_NAME)
set(ign_manual_search_TARGET_NAME "${package}::${package}")
if(NOT gz_manual_search_TARGET_NAME)
set(gz_manual_search_TARGET_NAME "${package}::${package}")
endif()

find_path(${package}_INCLUDE_DIRS
NAMES ${ign_manual_search_HEADER_NAMES}
PATH_SUFFIXES ${ign_manual_search_PATH_SUFFIXES})
NAMES ${gz_manual_search_HEADER_NAMES}
PATH_SUFFIXES ${gz_manual_search_PATH_SUFFIXES})
find_library(${package}_LIBRARIES
NAMES ${ign_manual_search_LIBRARY_NAMES}
PATH_SUFFIXES ${ign_manual_search_PATH_SUFFIXES})
NAMES ${gz_manual_search_LIBRARY_NAMES}
PATH_SUFFIXES ${gz_manual_search_PATH_SUFFIXES})

mark_as_advanced(${package}_INCLUDE_DIRS)
mark_as_advanced(${package}_LIBRARIES)
Expand Down
22 changes: 11 additions & 11 deletions cmake/IgnPackaging.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -185,13 +185,13 @@ function(_ign_create_pkgconfig)

#------------------------------------
# Parse the arguments
cmake_parse_arguments(_ign_create_pkgconfig "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
cmake_parse_arguments(_gz_create_pkgconfig "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

#------------------------------------
# Choose which input file to use
if(_ign_create_pkgconfig_COMPONENT)
if(_gz_create_pkgconfig_COMPONENT)
set(pkgconfig_input "${IGNITION_CMAKE_DIR}/pkgconfig/ignition-component.pc.in")
set(target_name ${PROJECT_LIBRARY_TARGET_NAME}-${_ign_create_pkgconfig_COMPONENT})
set(target_name ${PROJECT_LIBRARY_TARGET_NAME}-${_gz_create_pkgconfig_COMPONENT})
else()
set(pkgconfig_input "${IGNITION_CMAKE_DIR}/pkgconfig/ignition.pc.in")
set(target_name ${PROJECT_LIBRARY_TARGET_NAME})
Expand Down Expand Up @@ -249,24 +249,24 @@ function(_ign_create_cmake_package)

#------------------------------------
# Parse the arguments
cmake_parse_arguments(_ign_create_cmake_package "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
cmake_parse_arguments(_gz_create_cmake_package "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})

if(_ign_create_cmake_package_COMPONENT AND _ign_create_cmake_package_ALL)
if(_gz_create_cmake_package_COMPONENT AND _gz_create_cmake_package_ALL)
message(FATAL_ERROR
"_ign_create_cmake_package was called with both ALL and COMPONENT "
"_gz_create_cmake_package was called with both ALL and COMPONENT "
"specified. This is not allowed!")
endif()

#------------------------------------
# Set configuration arguments
if(_ign_create_cmake_package_COMPONENT)
if(_gz_create_cmake_package_COMPONENT)

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

elseif(_ign_create_cmake_package_ALL)
elseif(_gz_create_cmake_package_ALL)

set(ign_config_input "${IGNITION_CMAKE_DIR}/ignition-all-config.cmake.in")
set(target_name ${PROJECT_LIBRARY_TARGET_NAME}-all)
Expand All @@ -281,9 +281,9 @@ function(_ign_create_cmake_package)

endif()

if(_ign_create_cmake_package_LEGACY_PROJECT_PREFIX)
if(_gz_create_cmake_package_LEGACY_PROJECT_PREFIX)

set(LEGACY_PROJECT_PREFIX ${_ign_create_cmake_package_LEGACY_PROJECT_PREFIX})
set(LEGACY_PROJECT_PREFIX ${_gz_create_cmake_package_LEGACY_PROJECT_PREFIX})

else()

Expand Down
Loading