Files
weaseljson/CMakeLists.txt
2025-05-17 17:15:01 -04:00

54 lines
1.4 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()
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
add_link_options(LINKER:--gc-sections)
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_include_directories(mytest PRIVATE include)
target_link_libraries(mytest PRIVATE doctest nanobench simdjson)
doctest_discover_tests(mytest)
add_executable(validate src/validate.cpp)
target_include_directories(validate PRIVATE include)