From fa78b87691592fc93c1c5fa3845ce7a33e5fca5d Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Mon, 14 Sep 2020 15:59:37 +0300 Subject: disable incremental linking for the tests --- CMakeLists.txt | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) 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) -- cgit v1.2.3