-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
53 lines (38 loc) · 1.54 KB
/
Copy pathCMakeLists.txt
File metadata and controls
53 lines (38 loc) · 1.54 KB
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
cmake_minimum_required(VERSION 3.16)
project(FastMath2 VERSION 0.3.2)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
#if (CMAKE_COMPILER_IS_GNUCXX)
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O3")
#elseif (MSVC)
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17")
#else ()
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -O3")
#endif (CMAKE_COMPILER_IS_GNUCXX)
set(PROJECT_TOP_DIR ${PROJECT_SOURCE_DIR})
set(CMAKE_INSTALL_PREFIX ${PROJECT_SOURCE_DIR}/bin)
#add_library(FastMath INTERFACE)
#target_include_directories(FastMath PUBLIC src)
option(ENABLE_UNIT_TESTS "Enable unit tests" ON)
option(ENABLE_DEVELOPMENT "Enable development" ON)
option(ENABLE_EXAMPLE "Enable example" ON)
if(${ENABLE_UNIT_TESTS})
add_definitions(-DENABLE_UNIT_TESTS)
add_subdirectory(test)
endif()
if(${ENABLE_DEVELOPMENT})
add_executable(develop develop.cpp)
target_include_directories(develop PUBLIC ${PROJECT_TOP_DIR}/FastMath)
endif()
if (${ENABLE_EXAMPLE})
SET(TEST_INSTALL_DIR ${PROJECT_TOP_DIR}/bin/examples)
FILE(GLOB EXAMPLE_SRC "${PROJECT_SOURCE_DIR}/examples/*.cpp")
foreach(item IN LISTS EXAMPLE_SRC)
get_filename_component(SRCNAME ${item} NAME_WE) #得到文件的名字,不带扩展名
add_executable(${SRCNAME} ${item})
target_include_directories(${SRCNAME} PUBLIC ${PROJECT_TOP_DIR}/FastMath)
install(TARGETS ${SRCNAME} DESTINATION ${TEST_INSTALL_DIR})
message(STATUS "Example : ${SRCNAME} <- ${item}")
endforeach ()
endif ()