-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
90 lines (76 loc) · 3.12 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
## =============================================================================
## Cento
## Copyright : Oliver John Hitchcock
## SPDX-License-Identifier: BSL-1.0
## =============================================================================
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
project(Cento
VERSION 0.1.00
DESCRIPTION "An implementation of John K. Outsterhout's Corner Stiching."
LANGUAGES CXX
)
# determine whether this is a standalone project or included by other projects
if (NOT DEFINED CENTO_STANDALONE_PROJECT)
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(CENTO_STANDALONE_PROJECT ON)
else()
set(CENTO_STANDALONE_PROJECT OFF)
endif ()
endif()
option(CENTO_ACUS "Build the Acus application" ${CENTO_STANDALONE_PROJECT})
option(CENTO_TESTS "Build tests" ${CENTO_STANDALONE_PROJECT})
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
# Do stuff depending on the compiler
if (MSVC)
# warning level 4 and all warnings as errors
add_compile_options(/W4)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
else()
# lots of warnings and all warnings as errors
add_compile_options(-Wall -Wextra -pedantic -Werror)
endif()
add_library(cento_lib INTERFACE)
target_include_directories(
cento_lib
INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:include>
)
write_basic_package_version_file(
"${PROJECT_BINARY_DIR}/centoConfigVersion.cmake"
COMPATIBILITY SameMinorVersion
)
install(
TARGETS cento_lib
EXPORT centoTargets
LIBRARY DESTINATION lib COMPONENT Runtime
ARCHIVE DESTINATION lib COMPONENT Development
RUNTIME DESTINATION bin COMPONENT Runtime
PUBLIC_HEADER DESTINATION include COMPONENT Development
BUNDLE DESTINATION bin COMPONENT Runtime
)
configure_package_config_file("${PROJECT_SOURCE_DIR}/cmake/centoConfig.cmake.in"
"${PROJECT_BINARY_DIR}/centoConfig.cmake"
INSTALL_DESTINATION lib/cmake/cento)
install(EXPORT centoTargets DESTINATION lib/cmake/cento)
install(FILES "${PROJECT_BINARY_DIR}/centoConfigVersion.cmake"
"${PROJECT_BINARY_DIR}/centoConfig.cmake"
DESTINATION lib/cmake/cento)
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include)
add_library(Cento::cento ALIAS cento_lib)
if(CENTO_ACUS)
include(cmake/CPM.cmake)
add_subdirectory(acus)
endif()
if (CENTO_TESTS)
include(CTest)
add_subdirectory(test)
endif()
if(CENTO_ACUS AND CENTO_TESTS)
add_test(NAME CentoAcusExample1 COMMAND cento_acus "midi" "${CMAKE_SOURCE_DIR}/testcase/example1.txt")
add_test(NAME CentoAcusExample2 COMMAND cento_acus "midi" "${CMAKE_SOURCE_DIR}/testcase/example2.txt")
add_test(NAME CentoAcusExample3 COMMAND cento_acus "midi" "${CMAKE_SOURCE_DIR}/testcase/example3.txt")
add_test(NAME CentoAcusResArray COMMAND cento_acus "lisp" "${CMAKE_SOURCE_DIR}/testcase/res_array.acus")
add_test(NAME CentoAcusMemArray COMMAND cento_acus "lisp" "${CMAKE_SOURCE_DIR}/testcase/mem_array.acus")
endif()