Skip to content

Commit

Permalink
[msvc] Fix quoting of OSRM_PROJECT_DIR as preprocessor define
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mloskot authored and Patrick Niklaus committed Feb 14, 2018
1 parent d8e3b03 commit faff2c7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit faff2c7

Please sign in to comment.