diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2020-09-14 15:59:37 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2020-09-14 16:02:26 +0300 |
commit | fa78b87691592fc93c1c5fa3845ce7a33e5fca5d (patch) | |
tree | b51bb87f0e70caebf7a6d4355bf7e65b907f13b3 /CMakeLists.txt | |
parent | unit_tests: more call stack tests (diff) | |
download | winapi-debug-fa78b87691592fc93c1c5fa3845ce7a33e5fca5d.tar.gz winapi-debug-fa78b87691592fc93c1c5fa3845ce7a33e5fca5d.zip |
disable incremental linking for the tests
Diffstat (limited to '')
-rw-r--r-- | CMakeLists.txt | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3015fb2..d72fac8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,27 @@ cmake_minimum_required(VERSION 3.5) # for Boost::* imported targets project(pdb_repo CXX) +if(MSVC) + # This is an ugly hack to make the tests work. + # With incremental linking, the &func address does not point to the + # function code, but to a jmp instruction to the real code (or it's the + # other way around, I don't know). + # This is apparently caused by incremental linking, e.g. + # https://stackoverflow.com/questions/2485336/address-of-function-is-not-actual-code-address + string(REPLACE "/INCREMENTAL" "/INCREMENTAL:NO" + CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO + "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO}") + string(REPLACE "/INCREMENTAL" "/INCREMENTAL:NO" + CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO + "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO}") + string(REPLACE "/INCREMENTAL" "/INCREMENTAL:NO" + CMAKE_EXE_LINKER_FLAGS_DEBUG + "${CMAKE_EXE_LINKER_FLAGS_DEBUG}") + string(REPLACE "/INCREMENTAL" "/INCREMENTAL:NO" + CMAKE_SHARED_LINKER_FLAGS_DEBUG + "${CMAKE_SHARED_LINKER_FLAGS_DEBUG}") +endif() + include(cmake/common.cmake) find_package(Boost REQUIRED) |