proper cmake package
This commit is contained in:
parent
e456c8d930
commit
110a07d808
@ -3,17 +3,21 @@ 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")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -O3")
|
||||
endif()
|
||||
|
||||
add_subdirectory(src)
|
||||
|
||||
if(WITH_UNIT_TESTS)
|
||||
enable_testing()
|
||||
include_directories(
|
||||
vendor/Catch/single_include
|
||||
vendor/json.hpp/include)
|
||||
vendor/Catch/single_include
|
||||
vendor/json.hpp/include)
|
||||
add_subdirectory(test)
|
||||
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)
|
||||
|
||||
include_directories(
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
${Boost_INCLUDE_DIR})
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
${Boost_INCLUDE_DIR})
|
||||
|
||||
set(SRC
|
||||
state/in_section.cpp
|
||||
state/outside_section.cpp
|
||||
state/render_state.hpp
|
||||
visitor/get_token.hpp
|
||||
visitor/has_token.hpp
|
||||
visitor/is_node_empty.hpp
|
||||
visitor/render_node.hpp
|
||||
visitor/render_section.hpp
|
||||
mstch.cpp
|
||||
render_context.cpp
|
||||
template_type.cpp
|
||||
token.cpp
|
||||
utils.cpp)
|
||||
state/in_section.cpp
|
||||
state/outside_section.cpp
|
||||
state/render_state.hpp
|
||||
visitor/get_token.hpp
|
||||
visitor/has_token.hpp
|
||||
visitor/is_node_empty.hpp
|
||||
visitor/render_node.hpp
|
||||
visitor/render_section.hpp
|
||||
mstch.cpp
|
||||
render_context.cpp
|
||||
template_type.cpp
|
||||
token.cpp
|
||||
utils.cpp)
|
||||
|
||||
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 New Issue
Block a user