Skip to content

Commit

Permalink
Merge pull request #473 from tribal-tec/master
Browse files Browse the repository at this point in the history
Fix install in common_library() with subfolders
  • Loading branch information
tribal-tec committed Apr 8, 2016
2 parents 09d382b + 581b11c commit b33f337
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
* Add Sanitizer.cmake for gcc and clang runtime sanitizer support
* Add CoverageGcovr.cmake for gcovr support
* FindGLEW_MX considers GLEW_ROOT as environment and CMake variable
* Fix install in common_library() with subfolders
* Ignore moc and qrc files in coverage report
* Make CPACK_RESOURCE_FILE_LICENSE configurable
* New CompilerIdentification.cmake, resulted from splitting Compiler.cmake
Expand Down
4 changes: 2 additions & 2 deletions CommonLibrary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ function(_common_library Name)
endif()

# install(TARGETS ... PUBLIC_HEADER ...) flattens directories
install_files(include/${INCLUDE_NAME}
FILES ${PUBLIC_HEADERS} COMPONENT dev)
install_files(include/${INCLUDE_NAME} FILES ${PUBLIC_HEADERS}
COMPONENT dev BASE ${OUTPUT_INCLUDE_DIR}/${INCLUDE_NAME})
endfunction()

macro(generate_library_header NAME)
Expand Down
13 changes: 9 additions & 4 deletions InstallFiles.cmake
Original file line number Diff line number Diff line change
@@ -1,19 +1,24 @@
# Copyright (c) 2012 [email protected]
# Copyright (c) 2012-2016 [email protected]

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

include(CMakeParseArguments)

function(INSTALL_FILES PREFIX)
set(ARG_NAMES COMPONENT)
set(ARG_NAMES COMPONENT BASE)
set(ARGS_NAMES FILES)
cmake_parse_arguments(THIS "" "${ARG_NAMES}" "${ARGS_NAMES}" ${ARGN})

foreach(FILE ${THIS_FILES})
if(IS_ABSOLUTE ${FILE})
set(DIR)
if(THIS_BASE)
string(REPLACE ${THIS_BASE} "" DIR ${FILE})
string(REGEX MATCH "(.*)[/\\]" DIR ${DIR})
else()
set(DIR)
endif()
else()
string(REGEX MATCH "(.*)[/\\]" DIR ${FILE})
endif()
Expand Down

0 comments on commit b33f337

Please sign in to comment.