-
-
Notifications
You must be signed in to change notification settings - Fork 335
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
30 lines (25 loc) · 945 Bytes
/
CMakeLists.txt
File metadata and controls
30 lines (25 loc) · 945 Bytes
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
cmake_minimum_required(VERSION 3.22)
# Setup project
project(LwLibPROJECT C)
if(NOT PROJECT_IS_TOP_LEVEL)
add_subdirectory(lwrb)
else()
enable_testing()
add_executable(${PROJECT_NAME})
target_sources(${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_LIST_DIR}/dev/main.c
)
target_include_directories(${PROJECT_NAME} PUBLIC
${CMAKE_CURRENT_LIST_DIR}/dev
)
# Add subdir with lwrb and link to project
set(LWRB_COMPILE_DEFINITIONS LWRB_DEV)
add_subdirectory(lwrb)
target_link_libraries(${PROJECT_NAME} lwrb)
target_link_libraries(${PROJECT_NAME} lwrb_ex)
# Add compile options to the library, which will propagate options to executable through public link
target_compile_definitions(lwrb PUBLIC WIN32 _DEBUG CONSOLE LWRB_DEV)
target_compile_options(lwrb PUBLIC -Wall -Wextra -Wpedantic)
# Add test
add_test(NAME Test COMMAND $<TARGET_FILE:${CMAKE_PROJECT_NAME}>)
endif()