Skip to content

Commit b33f337

Browse files
committed
Merge pull request #473 from tribal-tec/master
Fix install in common_library() with subfolders
2 parents 09d382b + 581b11c commit b33f337

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

CHANGES.md

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
* Add Sanitizer.cmake for gcc and clang runtime sanitizer support
1818
* Add CoverageGcovr.cmake for gcovr support
1919
* FindGLEW_MX considers GLEW_ROOT as environment and CMake variable
20+
* Fix install in common_library() with subfolders
2021
* Ignore moc and qrc files in coverage report
2122
* Make CPACK_RESOURCE_FILE_LICENSE configurable
2223
* New CompilerIdentification.cmake, resulted from splitting Compiler.cmake

CommonLibrary.cmake

+2-2
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ function(_common_library Name)
203203
endif()
204204

205205
# install(TARGETS ... PUBLIC_HEADER ...) flattens directories
206-
install_files(include/${INCLUDE_NAME}
207-
FILES ${PUBLIC_HEADERS} COMPONENT dev)
206+
install_files(include/${INCLUDE_NAME} FILES ${PUBLIC_HEADERS}
207+
COMPONENT dev BASE ${OUTPUT_INCLUDE_DIR}/${INCLUDE_NAME})
208208
endfunction()
209209

210210
macro(generate_library_header NAME)

InstallFiles.cmake

+9-4
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,24 @@
1-
# Copyright (c) 2012 Stefan.Eilemann@epfl.ch
1+
# Copyright (c) 2012-2016 Stefan.Eilemann@epfl.ch
22

3-
# Usage: install_files(<prefix> FILES <files> [COMPONENT <name>])
3+
# Usage: install_files(<prefix> FILES <files> [COMPONENT <name>] [BASE <dir>])
44
# Installs files while preserving their relative directory. Files
55
# with an absolute path are installed directly into prefix.
66

77
include(CMakeParseArguments)
88

99
function(INSTALL_FILES PREFIX)
10-
set(ARG_NAMES COMPONENT)
10+
set(ARG_NAMES COMPONENT BASE)
1111
set(ARGS_NAMES FILES)
1212
cmake_parse_arguments(THIS "" "${ARG_NAMES}" "${ARGS_NAMES}" ${ARGN})
1313

1414
foreach(FILE ${THIS_FILES})
1515
if(IS_ABSOLUTE ${FILE})
16-
set(DIR)
16+
if(THIS_BASE)
17+
string(REPLACE ${THIS_BASE} "" DIR ${FILE})
18+
string(REGEX MATCH "(.*)[/\\]" DIR ${DIR})
19+
else()
20+
set(DIR)
21+
endif()
1722
else()
1823
string(REGEX MATCH "(.*)[/\\]" DIR ${FILE})
1924
endif()

0 commit comments

Comments
 (0)