Skip to content
Permalink
Browse files
crssync cmake file refactor
  • Loading branch information
tomasMizera authored and wonder-sk committed Dec 23, 2021
1 parent 7fbabb6 commit df41a587d5aae4a3dcda41e761da9b2265fcf724
Showing with 32 additions and 32 deletions.
  1. +2 −0 CMakeLists.txt
  2. +2 −3 src/CMakeLists.txt
  3. +28 −29 src/crssync/CMakeLists.txt
@@ -173,6 +173,8 @@ if(WITH_CORE)

set (WITH_QGIS_PROCESS TRUE CACHE BOOL "Determines whether the standalone \"qgis_process\" tool should be built")

set (NATIVE_CRSSYNC_BIN "" CACHE PATH "Path to a natively compiled synccrsdb binary. If set, crssync will not build but use provided bin instead.")

# try to configure and build python bindings by default
set (WITH_BINDINGS TRUE CACHE BOOL "Determines whether python bindings should be built")
if (WITH_BINDINGS)
@@ -15,9 +15,8 @@ if (WITH_GUI)
endif()

add_subdirectory(providers)
if (NOT IOS)
add_subdirectory(crssync)
endif()

add_subdirectory(crssync)

if (WITH_CRASH_HANDLER)
add_subdirectory(crashhandler)
@@ -1,35 +1,34 @@
add_executable(crssync main.cpp)
target_compile_features(crssync PRIVATE cxx_std_17)

target_link_libraries(crssync
qgis_core
${PROJ_LIBRARY}
${GDAL_LIBRARY}
)

if(MSVC AND NOT USING_NMAKE)
add_custom_target(synccrsdb
COMMENT "Running crssync"
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/crssync.exe
DEPENDS crssync
)
elseif(CMAKE_CROSSCOMPILING AND NOT MXE)
set(NATIVE_CRSSYNC_BIN CACHE PATH "Path to a natively compiled synccrsdb binary")
if(NOT NATIVE_CRSSYNC_BIN)
message(FATAL_ERROR "NATIVE_CRSSYNC_BIN needs to be defined when cross-compiling")
endif()
if (NATIVE_CRSSYNC_BIN)
add_custom_target(synccrsdb
COMMENT "Running native crssync"
COMMAND ${NATIVE_CRSSYNC_BIN}
DEPENDS crssync
)
else()
add_custom_target(synccrsdb
COMMENT "Running crssync"
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/crssync
DEPENDS crssync

else ()
add_executable(crssync main.cpp)
target_compile_features(crssync PRIVATE cxx_std_17)

target_link_libraries(crssync
qgis_core
${PROJ_LIBRARY}
${GDAL_LIBRARY}
)
endif()

install(CODE "message(\"Installing crssync ...\")")
install(TARGETS crssync RUNTIME DESTINATION ${QGIS_LIBEXEC_DIR})
if(MSVC AND NOT USING_NMAKE)
add_custom_target(synccrsdb
COMMENT "Running crssync"
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/crssync.exe
DEPENDS crssync
)
else()
add_custom_target(synccrsdb
COMMENT "Running crssync"
COMMAND ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/crssync
DEPENDS crssync
)
endif()

install(CODE "message(\"Installing crssync ...\")")
install(TARGETS crssync RUNTIME DESTINATION ${QGIS_LIBEXEC_DIR})

endif()

0 comments on commit df41a58

Please sign in to comment.