Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add cmake installation support (#82)
Adds cmake installation support
- Loading branch information
1 parent
c77d6f6
commit c46e42c
Showing
4 changed files
with
69 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
# Version 3.2 is needed to be able to have support of target_compile_features for AppleClang | ||
cmake_minimum_required(VERSION 3.2.0 FATAL_ERROR) | ||
|
||
# Sets the name of the project, and stores it in the variable PROJECT_NAME. When called from the top-level CMakeLists.txt also stores the project name in the variable CMAKE_PROJECT_NAME. | ||
project(Mach7) | ||
|
||
# Adds a subdirectory to the build. The source_dir specifies the directory in which the source CMakeLists.txt and code files are located. | ||
project(Mach7) | ||
|
||
add_subdirectory(code/test) | ||
|
||
# Define the library target | ||
add_library(Mach7 INTERFACE) | ||
add_library(Mach7::Mach7 ALIAS Mach7) | ||
|
||
install(TARGETS Mach7 | ||
EXPORT Mach7Targets | ||
LIBRARY DESTINATION lib COMPONENT Runtime | ||
ARCHIVE DESTINATION lib COMPONENT Development | ||
RUNTIME DESTINATION bin COMPONENT Runtime | ||
PUBLIC_HEADER DESTINATION include COMPONENT Development | ||
BUNDLE DESTINATION bin COMPONENT Runtime | ||
) | ||
|
||
include(CMakePackageConfigHelpers) | ||
configure_package_config_file( | ||
"${PROJECT_SOURCE_DIR}/cmake/Mach7Config.cmake.in" | ||
"${PROJECT_BINARY_DIR}/Mach7Config.cmake" | ||
INSTALL_DESTINATION lib/cmake/Mach7 | ||
) | ||
|
||
install(EXPORT Mach7Targets DESTINATION lib/cmake/Mach7) | ||
install(FILES | ||
"${PROJECT_BINARY_DIR}/Mach7Config.cmake" | ||
DESTINATION lib/cmake/Mach7) | ||
|
||
|
||
# for linux: copy header files to /usr/local/ by default | ||
# for windows: copy header fiels to c:/Program Files by default | ||
install( | ||
DIRECTORY ${CMAKE_SOURCE_DIR}/code/mach7/ | ||
DESTINATION include/mach7) | ||
install( | ||
DIRECTORY ${CMAKE_SOURCE_DIR}/code/xtl/ | ||
DESTINATION include/xtl) | ||
install( | ||
DIRECTORY ${CMAKE_SOURCE_DIR}/code/cppft/ | ||
DESTINATION include/cppft) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# https://stackoverflow.com/questions/47718485/install-and-export-interface-only-library-cmake | ||
@PACKAGE_INIT@ | ||
|
||
include("${CMAKE_CURRENT_LIST_DIR}/Mach7Targets.cmake") | ||
check_required_components("@PROJECT_NAME@") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters