forked from adishavit/argh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
46 lines (38 loc) · 1.79 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
project(argh)
cmake_minimum_required(VERSION 3.1)
set (CMAKE_CXX_STANDARD 11)
option(BUILD_TESTS "Build tests. Uncheck for install only runs" ON)
option(BUILD_EXAMPLES "Build examples. Uncheck for install only runs" ON)
if(BUILD_EXAMPLES)
add_executable(argh_example example.cpp)
endif()
if(BUILD_TESTS)
add_executable(argh_tests argh_tests.cpp)
endif()
add_library(argh INTERFACE)
target_include_directories(argh INTERFACE $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}> $<INSTALL_INTERFACE:include>)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT argh_tests)
if(BUILD_EXAMPLES OR BUILD_TESTS)
if(UNIX OR CMAKE_COMPILER_IS_GNUCXX)
add_definitions("-Wall -Wextra -Wshadow -Wnon-virtual-dtor -pedantic")
else(MSVC)
add_definitions("/W4 /WX")
endif()
endif()
install(TARGETS argh EXPORT arghTargets)
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
# this might be a bit too restrictive, since for other (BSD, ...) this might apply also
# but this can be fixed later in extra pull requests from people on the platform
include(GNUInstallDirs)
install(FILES "${CMAKE_CURRENT_LIST_DIR}/argh.h" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(FILES "${CMAKE_CURRENT_LIST_DIR}/LICENSE" DESTINATION ${CMAKE_INSTALL_DOCDIR})
install(FILES "${CMAKE_CURRENT_LIST_DIR}/README.md" DESTINATION ${CMAKE_INSTALL_DOCDIR})
install(FILES argh-config.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/argh)
install(EXPORT arghTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/argh)
else()
install(FILES "${CMAKE_CURRENT_LIST_DIR}/argh.h" DESTINATION include)
install(FILES "${CMAKE_CURRENT_LIST_DIR}/LICENSE" DESTINATION license)
install(FILES "${CMAKE_CURRENT_LIST_DIR}/README.md" DESTINATION .)
install(FILES argh-config.cmake DESTINATION CMake)
install(EXPORT arghTargets DESTINATION CMake)
endif()