Project

General

Profile

Bug #9270 » CMakeLists.txt

Steven Köhler, 10/31/2021 08:33 PM

 
#
cmake_minimum_required (VERSION 3.13)

# project
project (unique_id_test)

#
# CMake settings
#

# output directories
set (CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

# Wt
find_package (Wt REQUIRED)

# create executable
add_executable (unique_id_test)

# C++ standard
set_target_properties(unique_id_test
PROPERTIES
CXX_STANDARD 17
)

# compile definitions
target_compile_definitions (unique_id_test
PRIVATE
$<$<CONFIG:Debug>:DEBUG>
)

# compile options
target_compile_options (unique_id_test
PRIVATE
# MSVC
$<$<CXX_COMPILER_ID:MSVC>:/W4 /wd4251 /wd4275 -bigobj>
# Clang
$<$<CXX_COMPILER_ID:Clang>:-pedantic>
# GNU
$<$<CXX_COMPILER_ID:GNU>:-pedantic -Wall -fdiagnostics-color=always>
$<$<AND:$<CXX_COMPILER_ID:GNU>,$<CONFIG:Debug>>:-O0>
$<$<AND:$<CXX_COMPILER_ID:GNU>,$<CONFIG:Release>>:-O3>
)

# nasty hack to get rid of D9025 warnings caused by default
# /W3 flag in CMAKE_CXX_FLAGS
string (REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")

# dependent libraries
target_link_libraries (unique_id_test
PRIVATE
Wt::Wt
)

# source files
target_sources (unique_id_test
PRIVATE
main.cpp
)
(1-1/8)