proper cmake package
This commit is contained in:
parent
e456c8d930
commit
110a07d808
3 changed files with 61 additions and 20 deletions
|
@ -3,13 +3,17 @@ project(mstch)
|
|||
option (WITH_UNIT_TESTS "enable building unit test executable" OFF)
|
||||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
|
||||
set(CMAKE_BUILD_TYPE Release)
|
||||
|
||||
set(mstch_VERSION 0.2.2)
|
||||
|
||||
if(NOT MSVC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -O3")
|
||||
endif()
|
||||
|
||||
add_subdirectory(src)
|
||||
|
||||
if(WITH_UNIT_TESTS)
|
||||
enable_testing()
|
||||
include_directories(
|
||||
|
|
1
cmake/mstch-config.cmake
Normal file
1
cmake/mstch-config.cmake
Normal file
|
@ -0,0 +1 @@
|
|||
include("${CMAKE_CURRENT_LIST_DIR}/mstch-targets.cmake")
|
|
@ -21,5 +21,41 @@ set(SRC
|
|||
|
||||
add_library(mstch STATIC ${SRC})
|
||||
|
||||
install(TARGETS mstch DESTINATION lib)
|
||||
install(FILES ${CMAKE_SOURCE_DIR}/include/mstch/mstch.hpp DESTINATION include/mstch)
|
||||
set_property(TARGET mstch PROPERTY VERSION ${mstch_VERSION})
|
||||
|
||||
install(
|
||||
TARGETS mstch EXPORT mstchTargets
|
||||
LIBRARY DESTINATION lib
|
||||
ARCHIVE DESTINATION lib)
|
||||
|
||||
install(
|
||||
FILES "${CMAKE_SOURCE_DIR}/include/mstch/mstch.hpp"
|
||||
DESTINATION include/mstch
|
||||
COMPONENT Devel)
|
||||
|
||||
include(CMakePackageConfigHelpers)
|
||||
write_basic_package_version_file(
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/mstch/mstch-config-version.cmake"
|
||||
VERSION ${mstch_VERSION}
|
||||
COMPATIBILITY AnyNewerVersion)
|
||||
|
||||
export(
|
||||
EXPORT mstchTargets
|
||||
FILE "${CMAKE_CURRENT_BINARY_DIR}/mstch/mstch-targets.cmake"
|
||||
NAMESPACE mstch::)
|
||||
|
||||
configure_file(
|
||||
"${CMAKE_SOURCE_DIR}/cmake/mstch-config.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/mstch/mstch-config.cmake")
|
||||
|
||||
install(
|
||||
EXPORT mstchTargets
|
||||
FILE mstch-targets.cmake
|
||||
NAMESPACE mstch::
|
||||
DESTINATION lib/cmake/mstch)
|
||||
|
||||
install(FILES
|
||||
"${CMAKE_SOURCE_DIR}/cmake/mstch-config.cmake"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/mstch/mstch-config-version.cmake"
|
||||
DESTINATION lib/cmake/mstch
|
||||
COMPONENT Devel)
|
||||
|
|
Loading…
Reference in a new issue