diff --git a/CMakeLists.txt b/CMakeLists.txt index 56b64b57dc..5c9de0f644 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -267,6 +267,8 @@ endif() ################################################################################ +option(EMBED_PROJ_DATA_PATH "Whether the PROJ_DATA_PATH should be embedded" ON) + if(DEFINED PROJ_LIB_ENV_VAR_TRIED_LAST) set(PROJ_DATA_ENV_VAR_TRIED_LAST ${PROJ_LIB_ENV_VAR_TRIED_LAST}) message(WARNING "PROJ_LIB_ENV_VAR_TRIED_LAST option has been renamed to PROJ_DATA_ENV_VAR_TRIED_LAST. PROJ_LIB_ENV_VAR_TRIED_LAST is still working for now, but may be completely replaced by PROJ_DATA_ENV_VAR_TRIED_LAST in a future release") diff --git a/docs/source/install.rst b/docs/source/install.rst index 056523dbf0..2330a9e16c 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -414,6 +414,12 @@ All cached entries can be viewed using ``cmake -LAH`` from a build directory. Path to an existing directory used to cache :file:`proj.db` to speed-up subsequent builds without modifications to source SQL files. +.. option:: EMBED_PROJ_DATA_PATH + + .. versionadded:: 9.5 + + Embed ``PROJ_DATA`` hard-coded alternative path for data files location. Disable to avoid setting this non-relocatable hard-coded path. Default ON. + Building on Windows with vcpkg and Visual Studio 2017 or 2019 -------------------------------------------------------------------------------- diff --git a/src/lib_proj.cmake b/src/lib_proj.cmake index 0f8e08f8a5..c39e5dfd4d 100644 --- a/src/lib_proj.cmake +++ b/src/lib_proj.cmake @@ -303,7 +303,9 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}) source_group("CMake Files" FILES CMakeLists.txt) # Embed PROJ_DATA data files location -add_definitions(-DPROJ_DATA="${PROJ_DATA_PATH}") +if(EMBED_PROJ_DATA_PATH) + add_definitions(-DPROJ_DATA="${PROJ_DATA_PATH}") +endif() ###########################################################