Set OSRM_BUILD_DIR based on CMake build dir

For typical local workflow, CMake can auto-configure most
of the environment, for convenience.
This commit is contained in:
Mateusz Loskot 2017-07-19 12:07:06 +02:00 committed by Patrick Niklaus
parent 440dccb81b
commit cfa2a63323
2 changed files with 6 additions and 1 deletions

View File

@ -14,6 +14,11 @@ if(BUILD_AS_SUBPROJECT)
message(STATUS "Building libosrm as subproject.") message(STATUS "Building libosrm as subproject.")
endif() endif()
# set OSRM_BUILD_DIR location (might be used in various scripts)
if (NOT WIN32 AND NOT DEFINED ENV{OSRM_BUILD_DIR})
set(ENV{OSRM_BUILD_DIR} ${CMAKE_CURRENT_BINARY_DIR})
endif()
option(ENABLE_MASON "Use mason for dependencies" OFF) option(ENABLE_MASON "Use mason for dependencies" OFF)
option(ENABLE_CCACHE "Speed up incremental rebuilds via ccache" ON) option(ENABLE_CCACHE "Speed up incremental rebuilds via ccache" ON)
option(BUILD_TOOLS "Build OSRM tools" OFF) option(BUILD_TOOLS "Build OSRM tools" OFF)

View File

@ -96,7 +96,7 @@ set(TEST_DATA_DIR "${CMAKE_SOURCE_DIR}/test/data")
add_dependencies(library-tests osrm-extract osrm-contract osrm-partition) add_dependencies(library-tests osrm-extract osrm-contract osrm-partition)
# We can't run this Makefile on windows # We can't run this Makefile on windows
if (NOT WIN32) if (NOT WIN32)
add_custom_command(TARGET library-tests POST_BUILD COMMAND make -C ${TEST_DATA_DIR}) add_custom_command(TARGET library-tests POST_BUILD COMMAND make -C ${TEST_DATA_DIR} OSRM_BUILD_DIR=$ENV{OSRM_BUILD_DIR})
endif() endif()
target_compile_definitions(extractor-tests PRIVATE COMPILE_DEFINITIONS OSRM_FIXTURES_DIR="${CMAKE_SOURCE_DIR}/unit_tests/fixtures") target_compile_definitions(extractor-tests PRIVATE COMPILE_DEFINITIONS OSRM_FIXTURES_DIR="${CMAKE_SOURCE_DIR}/unit_tests/fixtures")