BillySheet/Unit testing/CMakeLists.txt
2022-01-16 18:47:24 +01:00

48 lines
1.2 KiB
CMake

cmake_minimum_required(VERSION 3.19 FATAL_ERROR)
project(UnitTest CXX)
set(COMPILE_FLAGS
-pipe
-march=skylake # change to native or your architecture.
-mtune=skylake # same as above
-mrdseed # be careful about this, this is linked to the x86 architecture.
-mrdrnd # same as above
-Wall
-Wextra
-Wpedantic
# -Wpadded
-pedantic
-ffunction-sections
-fdata-sections
-fuse-ld=gold
-funroll-loops
-fdevirtualize-at-ltrans
-fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free
)
set(LINKER_OPTIONS
-Wl,--sort-common,--as-needed,--gc-sections,--strip-all
-fuse-ld=gold
-fdevirtualize-at-ltrans
)
set(LINKER_FLAGS
jemalloc
)
add_executable(UnitTest adummy.cpp characteristics_tests.cpp)
set_target_properties(Catch2 UnitTest PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
CXX_EXTENSIONS OFF
INTERPROCEDURAL_OPTIMIZATION ON
# UNITY_BUILD ON
)
target_include_directories(UnitTest PRIVATE ${CMAKE_SOURCE_DIR}/include)
target_compile_definitions(UnitTest PRIVATE ${DEF_COMP})
target_compile_options(UnitTest PRIVATE ${COMPILE_FLAGS})
target_link_options(UnitTest PRIVATE ${LINKER_OPTIONS})
target_link_libraries(UnitTest ${LINKER_FLAGS} Catch2 nlohmann_json::nlohmann_json)