Skip to content

Commit

Permalink
Fixed Version.hh header output location in build-tree (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmadsen authored Jan 27, 2021
1 parent 317caa7 commit 79bd0dd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 36 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.0.1
1.0.2
46 changes: 11 additions & 35 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,31 +36,15 @@ get_property(PTL_INTERFACE_LIBRARIES GLOBAL PROPERTY ${PROJECT_NAME}_INTERFACE_L
################################################################################

configure_file(${PROJECT_SOURCE_DIR}/cmake/Templates/Version.hh.in
${CMAKE_CURRENT_BINARY_DIR}/Version.hh @ONLY)

list(APPEND ptl_headers ${CMAKE_CURRENT_BINARY_DIR}/Version.hh)

if(PTL_MASTER_PROJECT)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/Version.hh
DESTINATION
${PTL_INSTALL_INCLUDEDIR}/PTL)
else()
execute_process(
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_CURRENT_BINARY_DIR}/Version.hh
${CMAKE_CURRENT_LIST_DIR}/Version.hh
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
ERROR_VARIABLE ERR_MSG
RESULT_VARIABLE RET
)
install(
FILES
${CMAKE_CURRENT_LIST_DIR}/Version.hh
DESTINATION
${PTL_INSTALL_INCLUDEDIR}/PTL)
endif()
${CMAKE_CURRENT_BINARY_DIR}/PTL/Version.hh @ONLY)

list(APPEND ptl_headers ${CMAKE_CURRENT_BINARY_DIR}/PTL/Version.hh)

install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/PTL/Version.hh
DESTINATION
${PTL_INSTALL_INCLUDEDIR}/PTL)

################################################################################
# #
Expand All @@ -83,13 +67,9 @@ if(BUILD_SHARED_LIBS)

target_include_directories(ptl-shared INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/source>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
$<INSTALL_INTERFACE:${PTL_INSTALL_INCLUDEDIR}>)

if(PTL_MASTER_PROJECT)
target_include_directories(ptl-shared INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
endif()

list(APPEND INSTALL_LIBRARIES ptl-shared)
export(TARGETS ptl-shared ${PTL_INTERFACE_LIBRARIES}
FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-shared.cmake)
Expand All @@ -109,13 +89,9 @@ if(BUILD_STATIC_LIBS)

target_include_directories(ptl-static INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/source>
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>
$<INSTALL_INTERFACE:${PTL_INSTALL_INCLUDEDIR}>)

if(PTL_MASTER_PROJECT)
target_include_directories(ptl-static INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>)
endif()

list(APPEND INSTALL_LIBRARIES ptl-static)
export(TARGETS ptl-static ${PTL_INTERFACE_LIBRARIES}
FILE ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-static.cmake)
Expand Down

0 comments on commit 79bd0dd

Please sign in to comment.