-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
37 lines (30 loc) · 1.41 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
cmake_minimum_required(VERSION 3.27)
set(CMAKE_CXX_STANDARD 20)
set(project "tempest")
set(version "0.0.1")
project(${project} VERSION ${version})
add_compile_definitions(PROJECT_NAME="${project}" VERSION="${version}")
set(CMAKE_INSTALL_PREFIX "/usr/local" CACHE PATH "Installation prefix")
file(GLOB LIB_SOURCES src/core/*.hpp src/core/*.cpp)
add_library(${project} SHARED ${LIB_SOURCES})
target_compile_options(${project} PRIVATE)
set_target_properties(${project} PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
install(TARGETS ${project} LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)
file(GLOB CLI_SOURCES src/cli/*.cpp)
foreach(file ${CLI_SOURCES})
get_filename_component(name ${file} NAME_WE)
add_executable(${name} ${file})
find_package(Boost REQUIRED COMPONENTS program_options)
target_link_libraries(${name} ${project} Boost::program_options)
if(${name} STREQUAL "main")
set_target_properties(${name} PROPERTIES OUTPUT_NAME "${project}")
else()
set_target_properties(${name} PROPERTIES OUTPUT_NAME "${project}-${name}")
endif()
install(TARGETS ${name} RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
endforeach(file ${CLI_SOURCES})
if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
endif(CMAKE_COMPILER_IS_GNUCXX)
file(GLOB HEADERS src/core/*.hpp)
install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/${project})