Adding a new flag to tell Visual Studio to include debugging information (#1026)

in the release builds. This makes it easier to profile inside Intel
VTune when needed.
This commit is contained in:
Daniel Lemire 2020-07-06 17:53:57 -04:00 committed by GitHub
parent 770cee7139
commit 4015f46b7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -75,7 +75,7 @@ set(THREADS_PREFER_PTHREAD_FLAG ON)
# set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
#endif()
option(SIMDJSON_VISUAL_STUDIO_BUILD_WITH_DEBUG_INFO_FOR_PROFILING "Under Visual Studio, add Zi to the compile flag and DEBUG to the link file to add debugging information to the release build for easier profiling inside tools like VTune" OFF)
if(MSVC)
if("${MSVC_TOOLSET_VERSION}" STREQUAL "140")
# Visual Studio 2015 issues warnings and we tolerate it, cmake -G"Visual Studio 14" ..
@ -84,6 +84,10 @@ else()
# Recent version of Visual Studio expected (2017, 2019...). Prior versions are unsupported.
target_compile_options(simdjson-internal-flags INTERFACE /WX /W3 /sdl /w34714) # https://docs.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-4-c4714?view=vs-2019
endif()
if(SIMDJSON_VISUAL_STUDIO_BUILD_WITH_DEBUG_INFO_FOR_PROFILING)
target_link_options(simdjson-flags INTERFACE /DEBUG )
target_compile_options(simdjson-flags INTERFACE /Zi )
endif()
else()
target_compile_options(simdjson-internal-flags INTERFACE -fPIC)
target_compile_options(simdjson-internal-flags INTERFACE -Werror -Wall -Wextra -Weffc++)