proper cmake package
This commit is contained in:
parent
e456c8d930
commit
110a07d808
3 changed files with 61 additions and 20 deletions
|
@ -3,17 +3,21 @@ project(mstch)
|
||||||
option (WITH_UNIT_TESTS "enable building unit test executable" OFF)
|
option (WITH_UNIT_TESTS "enable building unit test executable" OFF)
|
||||||
|
|
||||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
|
set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
|
||||||
set(CMAKE_BUILD_TYPE Release)
|
set(CMAKE_BUILD_TYPE Release)
|
||||||
|
|
||||||
|
set(mstch_VERSION 0.2.2)
|
||||||
|
|
||||||
if(NOT MSVC)
|
if(NOT MSVC)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -O3")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -O3")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
||||||
if(WITH_UNIT_TESTS)
|
if(WITH_UNIT_TESTS)
|
||||||
enable_testing()
|
enable_testing()
|
||||||
include_directories(
|
include_directories(
|
||||||
vendor/Catch/single_include
|
vendor/Catch/single_include
|
||||||
vendor/json.hpp/include)
|
vendor/json.hpp/include)
|
||||||
add_subdirectory(test)
|
add_subdirectory(test)
|
||||||
endif()
|
endif()
|
||||||
|
|
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")
|
|
@ -1,25 +1,61 @@
|
||||||
find_package(Boost 1.54 REQUIRED)
|
find_package(Boost 1.54 REQUIRED)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
${CMAKE_SOURCE_DIR}/include
|
${CMAKE_SOURCE_DIR}/include
|
||||||
${Boost_INCLUDE_DIR})
|
${Boost_INCLUDE_DIR})
|
||||||
|
|
||||||
set(SRC
|
set(SRC
|
||||||
state/in_section.cpp
|
state/in_section.cpp
|
||||||
state/outside_section.cpp
|
state/outside_section.cpp
|
||||||
state/render_state.hpp
|
state/render_state.hpp
|
||||||
visitor/get_token.hpp
|
visitor/get_token.hpp
|
||||||
visitor/has_token.hpp
|
visitor/has_token.hpp
|
||||||
visitor/is_node_empty.hpp
|
visitor/is_node_empty.hpp
|
||||||
visitor/render_node.hpp
|
visitor/render_node.hpp
|
||||||
visitor/render_section.hpp
|
visitor/render_section.hpp
|
||||||
mstch.cpp
|
mstch.cpp
|
||||||
render_context.cpp
|
render_context.cpp
|
||||||
template_type.cpp
|
template_type.cpp
|
||||||
token.cpp
|
token.cpp
|
||||||
utils.cpp)
|
utils.cpp)
|
||||||
|
|
||||||
add_library(mstch STATIC ${SRC})
|
add_library(mstch STATIC ${SRC})
|
||||||
|
|
||||||
install(TARGETS mstch DESTINATION lib)
|
set_property(TARGET mstch PROPERTY VERSION ${mstch_VERSION})
|
||||||
install(FILES ${CMAKE_SOURCE_DIR}/include/mstch/mstch.hpp DESTINATION include/mstch)
|
|
||||||
|
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