Skip to content

Commit

Permalink
CMake: add option EMBED_PROJ_DATA_PATH (#4207)
Browse files Browse the repository at this point in the history
  • Loading branch information
WangWeiLin-MV authored Aug 12, 2024
1 parent e3f7098 commit bddac14
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
6 changes: 6 additions & 0 deletions docs/source/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
--------------------------------------------------------------------------------
Expand Down
4 changes: 3 additions & 1 deletion src/lib_proj.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()


###########################################################
Expand Down

0 comments on commit bddac14

Please sign in to comment.