Skip to content

Commit

Permalink
Make $<INSTALL_INTERFACE... use INCLUDE_INSTALL_DIR, and install head…
Browse files Browse the repository at this point in the history
…ers to include/${PROJECT_NAME} (#120)

* Make $<INSTALL_INTERFACE... use INCLUDE_INSTALL_DIR

Signed-off-by: Shane Loretz <[email protected]>

* Install headers to include/${PROJECT_NAME}

Signed-off-by: Shane Loretz <[email protected]>

* Add missing trailing slash

Signed-off-by: Shane Loretz <[email protected]>

* Add option APPEND_PROJECT_NAME_TO_INCLUDEDIR

Signed-off-by: Shane Loretz <[email protected]>

* Misc Fixes

Signed-off-by: Shane Loretz <[email protected]>

* Unset _include_dir when finished with it

Signed-off-by: Shane Loretz <[email protected]>
  • Loading branch information
sloretz authored Mar 8, 2022
1 parent d39e820 commit 0b5efc0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 12 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,19 @@ endif()
###############################################################################
# Installation paths
###############################################################################
option(APPEND_PROJECT_NAME_TO_INCLUDEDIR
"When ON headers are installed to a path ending with a folder called \
${PROJECT_NAME}. This avoids include directory search order issues when \
overriding this package from a merged catkin, ament, or colcon workspace."
OFF)

set(BIN_INSTALL_DIR bin/ CACHE PATH "Installation directory for binaries")
set(INCLUDE_INSTALL_DIR include/ CACHE PATH "Installation directory for C++ headers")
set(_include_dir "include/")
if(APPEND_PROJECT_NAME_TO_INCLUDEDIR)
string(APPEND _include_dir "${PROJECT_NAME}/")
endif()
set(INCLUDE_INSTALL_DIR "${_include_dir}" CACHE PATH "Installation directory for C++ headers")
unset(_include_dir)
set(LIB_INSTALL_DIR lib${LIB_SUFFIX}/ CACHE PATH "Installation directory for libraries")
set(DATA_INSTALL_DIR share/ CACHE PATH "Installation directory for data")
if(WIN32)
Expand Down
2 changes: 1 addition & 1 deletion src/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ elseif(NOT EPROSIMA_INSTALLER)
# Define public headers
target_include_directories(${PROJECT_NAME} PUBLIC
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> $<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/include>
$<INSTALL_INTERFACE:include>
$<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}>
)

if(MSVC OR MSVC_IDE)
Expand Down

0 comments on commit 0b5efc0

Please sign in to comment.