Skip to content

Commit

Permalink
CMake: adopt CMAKE_INSTALL_<dir> for install locations (#347)
Browse files Browse the repository at this point in the history
* CMake: adopt CMAKE_INSTALL_<dir> for install locations

* CMake: adopt more CMAKE_INSTALL_INCLUDEDIR for install locations

* CMake: adopt CMAKE_INSTALL_<DIR> for qa install locations

* Windows: correct paths
  • Loading branch information
bramoosterhuis authored May 23, 2024
1 parent bf95f4e commit 2cf0383
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 31 deletions.
20 changes: 10 additions & 10 deletions definitions/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ file(GLOB QA_INTERFACE_FILE ${WORKING_VARIABLE})
set(PUBLIC_HEADERS "definitions.h" "ValuePoint.h" "Module.h")

if(NOT GENERATOR_SEARCH_PATH)
set(GENERATOR_SEARCH_PATH ${CMAKE_SYSROOT}${CMAKE_INSTALL_PREFIX}/include/${NAMESPACE})
set(GENERATOR_SEARCH_PATH ${CMAKE_SYSROOT}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE})
endif()

JsonGenerator(CODE INPUT ${JSON_FILE} OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/generated" INCLUDE_PATH ${GENERATOR_SEARCH_PATH} CPPIFDIR "${CMAKE_CURRENT_SOURCE_DIR}/../interfaces/")
Expand Down Expand Up @@ -105,27 +105,27 @@ target_include_directories(${Target}
PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
$<INSTALL_INTERFACE:include/${NAMESPACE}>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE}>
)

install(
TARGETS ${Target} EXPORT ${Target}Targets # for downstream dependencies
ARCHIVE DESTINATION lib/ COMPONENT libs # static lib
LIBRARY DESTINATION lib/ COMPONENT libs # shared lib
RUNTIME DESTINATION bin COMPONENT libs # binaries
FRAMEWORK DESTINATION bin/ COMPONENT libs # for mac
PUBLIC_HEADER DESTINATION include/${NAMESPACE}/definitions COMPONENT devel # headers for mac (note the different component -> different package)
INCLUDES DESTINATION include/${NAMESPACE} # default include path
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/ COMPONENT libs # static lib
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/ COMPONENT libs # shared lib
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libs # binaries
FRAMEWORK DESTINATION ${CMAKE_INSTALL_BINDIR}/ COMPONENT libs # for mac
PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE}/definitions COMPONENT devel # headers for mac (note the different component -> different package)
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE} # default include path
)

install(
FILES ${JSON_LINK_HEADERS}
DESTINATION include/${NAMESPACE}/interfaces/json
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE}/interfaces/json
)

install(
FILES ${QA_JSON_LINK_HEADERS}
DESTINATION include/${NAMESPACE}/qa_interfaces/json
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE}/qa_interfaces/json
)

InstallPackageConfig(
Expand Down
4 changes: 2 additions & 2 deletions definitions/Definitions.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -290,10 +290,10 @@
<CustomBuild Include="..\jsonrpc\SystemCommands.json">
<FileType>Document</FileType>
</CustomBuild>
<CustomBuild Include="..\jsonrpc\TestController.json">
<CustomBuild Include="..\qa_jsonrpc\TestController.json">
<FileType>Document</FileType>
</CustomBuild>
<CustomBuild Include="..\jsonrpc\TestUtility.json">
<CustomBuild Include="..\qa_jsonrpc\TestUtility.json">
<FileType>Document</FileType>
</CustomBuild>
<CustomBuild Include="..\jsonrpc\TimeSync.json">
Expand Down
4 changes: 2 additions & 2 deletions definitions/Definitions.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,10 @@
<CustomBuild Include="..\jsonrpc\SystemCommands.json">
<Filter>Contracts</Filter>
</CustomBuild>
<CustomBuild Include="..\jsonrpc\TestController.json">
<CustomBuild Include="..\qa_jsonrpc\TestController.json">
<Filter>Contracts</Filter>
</CustomBuild>
<CustomBuild Include="..\jsonrpc\TestUtility.json">
<CustomBuild Include="..\qa_jsonrpc\TestUtility.json">
<Filter>Contracts</Filter>
</CustomBuild>
<CustomBuild Include="..\jsonrpc\TimeSync.json">
Expand Down
12 changes: 6 additions & 6 deletions interfaces/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ find_package(${NAMESPACE}COM REQUIRED)
set(Target ${NAMESPACE}${PROJECT_NAME})

if(NOT GENERATOR_SEARCH_PATH)
set(GENERATOR_SEARCH_PATH ${CMAKE_SYSROOT}${CMAKE_INSTALL_PREFIX}/include/${NAMESPACE})
set(GENERATOR_SEARCH_PATH ${CMAKE_SYSROOT}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE})
endif()

separate_arguments(INTERFACES_PATTERNS)
Expand Down Expand Up @@ -69,24 +69,24 @@ string(TOLOWER ${NAMESPACE} NAMESPACE_LIB)

install(
TARGETS ${Target} EXPORT ${Target}Targets # for downstream dependencies
LIBRARY DESTINATION lib/${NAMESPACE_LIB}/proxystubs COMPONENT libs # shared lib
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/${NAMESPACE_LIB}/proxystubs COMPONENT libs # shared lib
)

install(
FILES ${INTERFACES_HEADERS}
DESTINATION include/${NAMESPACE}/interfaces
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE}/interfaces
)

install(
FILES ${JSON_HEADERS}
DESTINATION include/${NAMESPACE}/interfaces/json
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE}/interfaces/json
)

include(CreateLink)

CreateLink(
LINK "${CMAKE_SYSROOT}${CMAKE_INSTALL_PREFIX}/include/cdmi.h"
TARGET "${CMAKE_SYSROOT}${CMAKE_INSTALL_PREFIX}/include/${NAMESPACE}/interfaces/IDRM.h"
LINK "${CMAKE_SYSROOT}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/cdmi.h"
TARGET "${CMAKE_SYSROOT}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE}/interfaces/IDRM.h"
)


Expand Down
14 changes: 3 additions & 11 deletions qa_interfaces/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ find_package(${NAMESPACE}COM REQUIRED)
set(Target ${NAMESPACE}${PROJECT_NAME})

if(NOT GENERATOR_SEARCH_PATH)
set(GENERATOR_SEARCH_PATH ${CMAKE_SYSROOT}${CMAKE_INSTALL_PREFIX}/include/${NAMESPACE})
set(GENERATOR_SEARCH_PATH ${CMAKE_SYSROOT}${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE})
endif()

separate_arguments(INTERFACES_PATTERNS)
Expand Down Expand Up @@ -68,18 +68,10 @@ string(TOLOWER ${NAMESPACE} NAMESPACE_LIB)

install(
TARGETS ${Target} EXPORT ${Target}Targets # for downstream dependencies
LIBRARY DESTINATION lib/${NAMESPACE_LIB}/proxystubs COMPONENT libs # shared lib
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/${NAMESPACE_LIB}/proxystubs COMPONENT libs # shared lib
)

install(
FILES ${QA_INTERFACES_HEADERS}
DESTINATION include/${NAMESPACE}/qa_interfaces
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${NAMESPACE}/qa_interfaces
)








0 comments on commit 2cf0383

Please sign in to comment.