Skip to content

Commit

Permalink
crssync cmake file refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasMizera authored and m-kuhn committed Jan 5, 2022
1 parent 9ba38a7 commit ca53936
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 32 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Expand Up @@ -155,6 +155,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)
Expand Down
5 changes: 2 additions & 3 deletions src/CMakeLists.txt
Expand Up @@ -15,9 +15,8 @@ if (WITH_GUI)
endif()

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

add_subdirectory(crssync)

if(WIN32 AND NOT MINGW)
add_subdirectory(crashhandler)
Expand Down
57 changes: 28 additions & 29 deletions src/crssync/CMakeLists.txt
@@ -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 ca53936

Please sign in to comment.