Skip to content

Commit

Permalink
Merge pull request #84 from dinocore1/cmake_install
Browse files Browse the repository at this point in the history
added support for cmake install
  • Loading branch information
nholthaus committed Sep 16, 2017
2 parents e618de6 + 6c8d6c7 commit a674ebb
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.2 FATAL_ERROR)

PROJECT(units)
PROJECT(units LANGUAGES CXX)

OPTION(BUILD_TESTS "Build unit tests" ON)
OPTION(BUILD_DOCS "Build the documentation" OFF)
Expand All @@ -23,7 +23,15 @@ endif()
# add_subdirectory(units) # or whatever you named the directory
# target_link_libraries(${PROJECT_NAME} units)
add_library(${PROJECT_NAME} INTERFACE)
target_include_directories(${PROJECT_NAME} INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include)

target_compile_features(${PROJECT_NAME}
INTERFACE cxx_variadic_templates
)

target_include_directories(${PROJECT_NAME}
INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)

# Remove IOStream from the library (useful for embdedded development)
if(DISABLE_IOSTREAM)
Expand All @@ -49,4 +57,16 @@ if(BUILD_DOCS)
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
endif(DOXYGEN_FOUND)
endif(BUILD_DOCS)
endif(BUILD_DOCS)

install(TARGETS units
EXPORT unitsConfig
)

install(DIRECTORY include/
DESTINATION include
)

install(EXPORT unitsConfig
DESTINATION cmake
)

0 comments on commit a674ebb

Please sign in to comment.