Browse Source

CMake: Reorganize root file

master
Riyyi 3 years ago
parent
commit
49448de932
  1. 32
      CMakeLists.txt

32
CMakeLists.txt

@ -1,5 +1,5 @@
# User config between these lines
# ------------------------------------------ # ------------------------------------------
# User config between these lines
# Set project name # Set project name
set(PROJECT "stowage") set(PROJECT "stowage")
@ -16,8 +16,7 @@ add_custom_target(run
# ------------------------------------------ # ------------------------------------------
cmake_minimum_required(VERSION 3.16 FATAL_ERROR) cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
project(${PROJECT} CXX)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Check if the build should include debugging symbols # Check if the build should include debugging symbols
option(DEBUG "" ${DEBUG}) option(DEBUG "" ${DEBUG})
@ -42,7 +41,19 @@ else()
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
endif() endif()
# Include all headers # ------------------------------------------
# Setup C++ compiler
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# ------------------------------------------
# Configure source
# Define include files
include_directories( include_directories(
"src" "src"
"test" "test"
@ -59,21 +70,14 @@ set(TEST_SOURCES ${TEST_SOURCES} ${MAIN_SOURCES})
list(REMOVE_ITEM TEST_SOURCES "${CMAKE_SOURCE_DIR}/src/main.cpp") list(REMOVE_ITEM TEST_SOURCES "${CMAKE_SOURCE_DIR}/src/main.cpp")
# ------------------------------------------ # ------------------------------------------
# Application target
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# ------------------------------------------
project(${PROJECT} CXX)
add_executable(${PROJECT} ${PROJECT_SOURCES}) add_executable(${PROJECT} ${PROJECT_SOURCES})
target_link_libraries(${PROJECT}) target_link_libraries(${PROJECT})
# ------------------------------------------
project(test CXX) # ------------------------------------------
# Unit test target
add_executable(test ${TEST_SOURCES}) add_executable(test ${TEST_SOURCES})
target_link_libraries(test) target_link_libraries(test)

Loading…
Cancel
Save