diff --git a/CMakeLists.txt b/CMakeLists.txt index 9668819d..2d71f4bb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,23 @@ cmake_minimum_required(VERSION 3.9) # CMP0069 NEW -include(CheckIPOSupported) -check_ipo_supported(RESULT ltoresult) -if(ltoresult) -set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) + +if (NOT CMAKE_BUILD_TYPE) + message(STATUS "No build type selected, default to Release") + set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) endif() +project(simdjson + DESCRIPTION "Parsing gigabytes of JSON per second" + LANGUAGES CXX +) + +# LTO seems to create all sorts of fun problems. Let us +# disable temporarily. +#include(CheckIPOSupported) +#check_ipo_supported(RESULT ltoresult) +#if(ltoresult) +#set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE) +#endif() + # usage: cmake -DSIMDJSON_DISABLE_AVX=on .. option(SIMDJSON_DISABLE_AVX "Forcefully disable AVX even if hardware supports it" OFF) @@ -14,12 +27,8 @@ set(CMAKE_MACOSX_RPATH OFF) set(CMAKE_THREAD_PREFER_PTHREAD ON) set(THREADS_PREFER_PTHREAD_FLAG ON) -if (NOT CMAKE_BUILD_TYPE) - message(STATUS "No build type selected, default to Release") - set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE) -endif() -project(simdjson) + set(SIMDJSON_LIB_NAME simdjson) set(PROJECT_VERSION_MAJOR 0) set(PROJECT_VERSION_MINOR 2) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 80dcf274..b00f56d7 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -5,6 +5,14 @@ if(MSVC) endif() add_cpp_test(basictests) + +## Next bit should not be needed! +#if(CMAKE_INTERPROCEDURAL_OPTIMIZATION) +# next line is a workaround for an odr-violation in basictests regarding the globals 0x432a40 and 0x52045c under clang +#set_tests_properties(basictests PROPERTIES +# ENVIRONMENT ASAN_OPTIONS="detect_odr_violation=0") +#endif() + add_cpp_test(jsoncheck) add_cpp_test(jsonstream_test) add_cpp_test(pointercheck)