cmake: a little refactor
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
c6695f4be3
commit
554030bbaa
|
@ -5,6 +5,7 @@ project(fortuna LANGUAGES CXX)
|
|||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
find_package(Git QUIET)
|
||||
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
|
||||
|
@ -23,7 +24,6 @@ endif()
|
|||
|
||||
add_subdirectory(lib/fmt EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(lib/fmtlog EXCLUDE_FROM_ALL)
|
||||
|
||||
add_subdirectory(lib/da_threading EXCLUDE_FROM_ALL)
|
||||
|
||||
if(NOT CMAKE_CXX_FLAGS MATCHES "-Wall")
|
||||
|
@ -157,7 +157,8 @@ add_subdirectory(lib/da_threading EXCLUDE_FROM_ALL)
|
|||
if(NOT CMAKE_CXX_FLAGS MATCHES "-fPIC")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
||||
endif(NOT CMAKE_CXX_FLAGS MATCHES "-fPIC")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIE -pie")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIE")
|
||||
add_compile_options (-fdiagnostics-show-location=once)
|
||||
|
||||
if(CMAKE_BUILD_TYPE MATCHES "Debug")
|
||||
set(LDFLAGS "${LDFLAGS} -Wl,-Og,โsort-common,โas-needed,-z,now,-pic,-pie")
|
||||
|
@ -187,6 +188,7 @@ add_subdirectory(lib/da_threading EXCLUDE_FROM_ALL)
|
|||
set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=lld")
|
||||
endif(NOT CMAKE_EXE_LINKER_FLAGS MATCHES "-fuse-ld=lld")
|
||||
endif()
|
||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_CXX_FLAGS}")
|
||||
|
||||
|
||||
set(FORTUNA_SOURCES
|
||||
|
@ -210,6 +212,9 @@ set(FORTUNA_HEADERS
|
|||
util.h
|
||||
seed_file_management.h)
|
||||
add_executable(fortuna ${FORTUNA_SOURCES} ${FORTUNA_HEADERS})
|
||||
target_include_directories(fortuna PRIVATE .)
|
||||
target_compile_features(fortuna PUBLIC cxx_std_20)
|
||||
|
||||
# ref: https://cmake.org/pipermail/cmake/2016-May/063400.html
|
||||
target_link_libraries(fortuna
|
||||
PRIVATE cryptopp
|
||||
|
|
2
Makefile
2
Makefile
|
@ -2,7 +2,7 @@ cppch = cppcheck
|
|||
cppch_args = --language=c++ --std=c++20 --enable=all --verbose --suppress=unmatchedSuppression --suppress=missingIncludeSystem ./*.{cpp,h}
|
||||
cpp_flags = CMAKE_CXX_FLAGS=
|
||||
c = cmake
|
||||
c_args = -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=
|
||||
c_args = -G Ninja -DCMAKE_BUILD_TYPE=
|
||||
n = ninja
|
||||
n_args = -C
|
||||
d_folder = cmake-build-debug
|
||||
|
|
Reference in New Issue