47 lines
1.2 KiB
CMake
47 lines
1.2 KiB
CMake
cmake_minimum_required(VERSION 3.5)
|
|
project(
|
|
project-name
|
|
VERSION 0.0.0
|
|
DESCRIPTION ""
|
|
HOMEPAGE_URL ""
|
|
LANGUAGES C CXX)
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
|
|
set(DEFAULT_BUILD_TYPE "Release")
|
|
|
|
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
|
message(
|
|
STATUS
|
|
"Setting build type to '${DEFAULT_BUILD_TYPE}' as none was specified.")
|
|
set(CMAKE_BUILD_TYPE
|
|
"${DEFAULT_BUILD_TYPE}"
|
|
CACHE STRING "Choose the type of build." FORCE)
|
|
# Set the possible values of build type for cmake-gui
|
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
|
|
"MinSizeRel" "RelWithDebInfo")
|
|
endif()
|
|
|
|
add_compile_options(
|
|
-Werror=switch-enum
|
|
-Wswitch-enum
|
|
-Wunused-variable
|
|
-fPIC
|
|
-fdata-sections
|
|
-ffunction-sections
|
|
-fno-omit-frame-pointer)
|
|
|
|
if(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64)
|
|
add_compile_options(-mavx)
|
|
endif()
|
|
|
|
add_subdirectory(third_party)
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
|
|
|
|
include(CTest)
|
|
include(doctest)
|
|
|
|
add_executable(mytest src/test.cpp)
|
|
target_link_libraries(mytest PRIVATE doctest nanobench simdjson)
|
|
doctest_discover_tests(mytest)
|