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

Project option: REPLACE_IGNITION_INCLUDE_PATH #190

Merged
merged 7 commits into from
Nov 12, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 3 additions & 3 deletions cmake/IgnConfigureBuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ macro(ign_configure_build)
set (CPPCHECK_INCLUDE_DIRS)
set (potential_cppcheck_include_dirs
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/include/ignition/${IGN_DESIGNATION}
${CMAKE_SOURCE_DIR}/include/${PROJECT_INCLUDE_DIR}
${CMAKE_SOURCE_DIR}/test/integration
${CMAKE_SOURCE_DIR}/test/regression
${CMAKE_SOURCE_DIR}/test/performance)
Expand Down Expand Up @@ -323,8 +323,8 @@ function(_ign_find_include_script)
add_subdirectory("${include_start}/include")
elseif(EXISTS "${include_start}/include/ignition/CMakeLists.txt")
add_subdirectory("${include_start}/include/ignition")
elseif(EXISTS "${include_start}/include/ignition/${IGN_DESIGNATION}/CMakeLists.txt")
add_subdirectory("${include_start}/include/ignition/${IGN_DESIGNATION}")
elseif(EXISTS "${include_start}/include/${PROJECT_INCLUDE_DIR}/CMakeLists.txt")
add_subdirectory("${include_start}/include/${PROJECT_INCLUDE_DIR}")
else()
message(AUTHOR_WARNING
"You have an include directory [${include_start}/include] without a "
Expand Down
12 changes: 10 additions & 2 deletions cmake/IgnConfigureProject.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
#
# Sets up an ignition library project.
#
# INCLUDE_DIR: Optional. Specify include folder names. Defaults to
# ignition/${IGN_DESIGNATION}
# NO_IGNITION_PREFIX: Optional. Don't use ignition as prefix in
# cmake project name.
# cmake project name.
# VERSION_SUFFIX: Optional. Specify a prerelease version suffix.
#
#===============================================================================
Expand All @@ -32,7 +34,7 @@ macro(ign_configure_project)
#------------------------------------
# Define the expected arguments
set(options NO_IGNITION_PREFIX)
set(oneValueArgs VERSION_SUFFIX)
set(oneValueArgs INCLUDE_DIR VERSION_SUFFIX)
set(multiValueArgs) # We are not using multiValueArgs yet

#------------------------------------
Expand Down Expand Up @@ -82,6 +84,12 @@ macro(ign_configure_project)
set(PROJECT_EXPORT_NAME ${PROJECT_NAME_LOWER})
set(PROJECT_LIBRARY_TARGET_NAME ${PROJECT_NAME_LOWER})

if(ign_configure_project_INCLUDE_DIR)
set(PROJECT_INCLUDE_DIR ${ign_configure_project_INCLUDE_DIR})
else()
set(PROJECT_INCLUDE_DIR ignition/${IGN_DESIGNATION})
endif()

# version <major>.<minor>
set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR})

Expand Down
16 changes: 8 additions & 8 deletions cmake/IgnUtils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -682,13 +682,13 @@ function(ign_install_all_headers)

# Add each header, prefixed by its directory, to the auto headers variable
foreach(header ${headers})
set(ign_headers "${ign_headers}#include <ignition/${IGN_DESIGNATION}/${header}>\n")
set(ign_headers "${ign_headers}#include <${PROJECT_INCLUDE_DIR}/${header}>\n")
endforeach()

if("." STREQUAL ${dir})
set(destination "${IGN_INCLUDE_INSTALL_DIR_FULL}/ignition/${IGN_DESIGNATION}")
set(destination "${IGN_INCLUDE_INSTALL_DIR_FULL}/${PROJECT_INCLUDE_DIR}")
else()
set(destination "${IGN_INCLUDE_INSTALL_DIR_FULL}/ignition/${IGN_DESIGNATION}/${dir}")
set(destination "${IGN_INCLUDE_INSTALL_DIR_FULL}/${PROJECT_INCLUDE_DIR}/${dir}")
endif()

install(
Expand All @@ -700,15 +700,15 @@ function(ign_install_all_headers)

# Add generated headers to the list of includes
foreach(header ${ign_install_all_headers_GENERATED_HEADERS})
set(ign_headers "${ign_headers}#include <ignition/${IGN_DESIGNATION}/${header}>\n")
set(ign_headers "${ign_headers}#include <${PROJECT_INCLUDE_DIR}/${header}>\n")
endforeach()

if(ign_install_all_headers_COMPONENT)

set(component_name ${ign_install_all_headers_COMPONENT})

# Define the install directory for the component meta header
set(meta_header_install_dir ${IGN_INCLUDE_INSTALL_DIR_FULL}/ignition/${IGN_DESIGNATION}/${component_name})
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)
Expand All @@ -717,7 +717,7 @@ function(ign_install_all_headers)
else()

# Define the install directory for the core master meta header
set(meta_header_install_dir ${IGN_INCLUDE_INSTALL_DIR_FULL}/ignition/${IGN_DESIGNATION})
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)
Expand Down Expand Up @@ -936,7 +936,7 @@ function(ign_create_core_library)
# Create the target for the core library, and configure it to be installed
_ign_add_library_or_component(
LIB_NAME ${PROJECT_LIBRARY_TARGET_NAME}
INCLUDE_DIR "ignition/${IGN_DESIGNATION_LOWER}"
INCLUDE_DIR "${PROJECT_INCLUDE_DIR}"
EXPORT_BASE IGNITION_${IGN_DESIGNATION_UPPER}
SOURCES ${sources}
${interface_option})
Expand Down Expand Up @@ -1120,7 +1120,7 @@ function(ign_add_component component_name)
# Create the target for this component, and configure it to be installed
_ign_add_library_or_component(
LIB_NAME ${component_target_name}
INCLUDE_DIR "ignition/${IGN_DESIGNATION_LOWER}/${include_subdir}"
INCLUDE_DIR "${PROJECT_INCLUDE_DIR}/${include_subdir}"
EXPORT_BASE IGNITION_${IGN_DESIGNATION_UPPER}_${component_name_upper}
SOURCES ${sources}
${interface_option})
Expand Down
4 changes: 3 additions & 1 deletion examples/no_ignition_prefix/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
cmake_minimum_required(VERSION 3.10.2 FATAL_ERROR)
project(no_ignition_prefix VERSION 0.1.0)
find_package(ignition-cmake2 REQUIRED)
ign_configure_project(NO_IGNITION_PREFIX)
ign_configure_project(
INCLUDE_DIR no_ign
NO_IGNITION_PREFIX)
ign_configure_build(QUIT_IF_BUILD_ERRORS)
ign_create_packages()
ign_create_docs()
11 changes: 4 additions & 7 deletions examples/no_ignition_prefix/src/AlmostEmpty.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,11 @@
*
*/

#include <ignition/no_ignition_prefix/Export.hh>
#include <no_ign/Export.hh>

namespace ignition
namespace no_ignition_prefix
{
namespace no_ignition_prefix
class IGNITION_NO_IGNITION_PREFIX_VISIBLE AlmostEmpty
{
class IGNITION_NO_IGNITION_PREFIX_VISIBLE AlmostEmpty
{
};
}
};
}