-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from terrylyons/cmake-files
Added basic cmake file
- Loading branch information
Showing
2 changed files
with
86 additions
and
0 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,72 @@ | ||
cmake_minimum_required(VERSION 3.0) | ||
|
||
# I took this from CATCH2's (V2.0) CMakeList.txt because | ||
# this seems to be close to our use case here. | ||
# https://github.com/catchorg/Catch2/blob/v2.x/CMakeLists.txt | ||
if(NOT DEFINED PROJECT_NAME) | ||
set(NOT_SUBPROJECT ON) | ||
else() | ||
set(NOT_SUBPROJECT OFF) | ||
endif() | ||
|
||
|
||
project(Libalgebra VERSION 1.0.0) | ||
|
||
|
||
include(GNUInstallDirs) | ||
|
||
|
||
set(CMAKE_CXX_STANDARD 98) | ||
|
||
find_package(Boost REQUIRED COMPONENTS thread) | ||
|
||
add_library(Libalgebra INTERFACE) | ||
|
||
target_include_directories(Libalgebra | ||
INTERFACE | ||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> | ||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}> | ||
) | ||
|
||
add_library(Libalgebra::Libalgebra ALIAS Libalgebra) | ||
|
||
target_link_libraries(Libalgebra INTERFACE Boost::boost Boost::thread) | ||
|
||
if(NOT_SUBPROJECT) | ||
install(TARGETS Libalgebra | ||
EXPORT LibalgebraTargets | ||
INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} | ||
) | ||
|
||
include(CMakePackageConfigHelpers) | ||
set(LIBALGEBRA_CMAKE_CONFIG_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Libalgebra") | ||
|
||
message(STATUS "Writing cmake config file") | ||
configure_package_config_file( | ||
LibalgebraConfig.cmake.in | ||
${CMAKE_CURRENT_BINARY_DIR}/LibalgebraConfig.cmake | ||
INSTALL_DESTINATION ${LIBALGEBRA_CMAKE_CONFIG_DESTINATION} | ||
PATH_VARS CMAKE_INSTALL_INCLUDEDIR | ||
) | ||
|
||
message(STATUS "Writing cmake config version file") | ||
write_basic_package_version_file( | ||
LibalgebraConfigVersion.cmake | ||
VERSION ${PACKAGE_VERSION} | ||
COMPATIBILITY SameMajorVersion | ||
ARCH_INDEPENDENT | ||
) | ||
|
||
message(STATUS "Installing config files to ${LIBALGEBRA_CMAKE_CONFIG_DESTINATION}") | ||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/LibalgebraConfig.cmake | ||
${CMAKE_CURRENT_BINARY_DIR}/LibalgebraConfigVersion.cmake | ||
DESTINATION ${LIBALGEBRA_CMAKE_CONFIG_DESTINATION} | ||
) | ||
|
||
|
||
install(EXPORT LibalgebraTargets | ||
FILE LibalgebraTargets.cmake | ||
NAMESPACE Libalgebra:: | ||
DESTINATION lib/cmake/Libalgebra | ||
) | ||
endif() |
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,14 @@ | ||
include(CMakeFindDependencyMacro) | ||
|
||
set(LIBALGEBRA_VERSION 1.0.0) | ||
|
||
@PACKAGE_INIT@ | ||
|
||
find_dependency(Boost COMPONENTS thread REQUIRED) | ||
|
||
set_and_check(LIBALGEBRA_INCLUDE_DIR "@CMAKE_INSTALL_INCLUDEDIR@") | ||
|
||
|
||
include(${CMAKE_CURRENT_LIST_DIR}/LibalgebraTargets.cmake) | ||
|
||
check_required_components(Libalgebra) |