Skip to content

Commit

Permalink
CMake: Make library splitting optional
Browse files Browse the repository at this point in the history
  • Loading branch information
dg0yt committed Mar 13, 2022
1 parent bee5aea commit 3af9ffd
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion cmake/helpers/GdalGenerateConfig.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
if ((NOT WIN32) OR MINGW)
set(split_libs_default ON)
else ()
set(split_libs_default OFF)
endif ()
option(GDAL_SPLIT_EXPORTED_LIBS "Split library path and name on export" ${split_libs_default})


# Return a flat list of libs including target linking requirements.
function(gdal_flatten_link_libraries _result)
set(_libs "")
Expand Down Expand Up @@ -188,7 +196,9 @@ function(gdal_get_lflags _result)
elseif(CMAKE_LINK_LIBRARY_FLAG STREQUAL "-l" AND _lib MATCHES "^-l")
# use _lib
elseif(EXISTS "${_lib}")
gdal_split_library_to_lflags(_lib _other "${_lib}")
if(GDAL_SPLIT_EXPORTED_LIBS)
gdal_split_library_to_lflags(_lib _other "${_lib}")
endif()
else()
set(_lib "${CMAKE_LINK_LIBRARY_FLAG}${_lib}")
endif()
Expand Down

0 comments on commit 3af9ffd

Please sign in to comment.