From faff2c774d09a7227c77ae4fa40d22d54bb00b45 Mon Sep 17 00:00:00 2001 From: Mateusz Loskot Date: Tue, 13 Feb 2018 23:57:17 +0100 Subject: [PATCH] [msvc] Fix quoting of OSRM_PROJECT_DIR as preprocessor define It looks MSVC still special handling, no quotoing as well as additional quoting like add_definitions(-DFOO="\\"foo\\"") as per https://cmake.org/pipermail/cmake/2007-June/014611.html does not seem to handle CMake variables correctly. This Visual C++ specific fix is based on this solution https://cmake.org/pipermail/cmake/2006-September/011292.html --- CMakeLists.txt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7b22cd273..6c2b7cdd6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,7 +64,11 @@ set(OSRM_VERSION_MINOR 16) set(OSRM_VERSION_PATCH 0) set(OSRM_VERSION "${OSRM_VERSION_MAJOR}.${OSRM_VERSION_MINOR}.${OSRM_VERSION_PATCH}") -add_definitions(-DOSRM_PROJECT_DIR="${CMAKE_CURRENT_SOURCE_DIR}") +if (MSVC) + add_definitions("-DOSRM_PROJECT_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}\"") +else() + add_definitions(-DOSRM_PROJECT_DIR="${CMAKE_CURRENT_SOURCE_DIR}") +endif() # these two functions build up custom variables: # DEPENDENCIES_INCLUDE_DIRS and OSRM_DEFINES