Issue
So I'm trying to add the /DYNAMICBASE
option like this:
add_definitions(/DYNAMICBASE)
and the result in MSVC when I look in the project c++ command line options is this:
/D "YNAMICBASE"
How am I supposed to add this flag? I also tried using CMAKE_CXX_FLAGS
but the same thing happens.
Solution
My comment (VStudio specific):
[MS.Learn]: /D (Preprocessor Definitions) is a compiler (cl.exe) flag, while [MS.Learn]: /DYNAMICBASE (Use address space layout randomization) is a linker (link.exe) one.
is only half of the answer, and that is finding the root cause.
Translating it into something that CMake understands (setting the [CMake]: CMAKE_SHARED_LINKER_FLAGS and [CMake]: CMAKE_EXE_LINKER_FLAGS variables) which is solving the problem, is @onqtam's merit.
Answered By - CristiFati Answer Checked By - David Goodson (WPSolving Volunteer)