Skip to content

Commit 3df1c4e

Browse files
committed
Fix to get unit tests working again on Mac.
make 'check', 'test' and 'Experimental' work from build directory to run tests. Current caveats: - Build will not install. Re-build with ENABLE_TESTS=FALSE to produce a build a functioning bundled .app. - Temp QGIS.app in build/output/bin directory will start, but also needs a different symlink for finding providers. Even then, the app doesn' work right. It appears to be unnecessary for running tests, so there is no advantage to running it from the build directory.
1 parent fcb86cf commit 3df1c4e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

CMakeLists.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,11 @@ ELSE (WIN32)
370370
SET (QGIS_PLUGIN_SUBDIR_REV ../../MacOS)
371371
SET (DEFAULT_INCLUDE_SUBDIR include/qgis)
372372
# path for framework references
373-
SET (CMAKE_INSTALL_NAME_DIR @executable_path/${QGIS_FW_SUBDIR})
373+
IF (ENABLE_TESTS)
374+
SET (CMAKE_INSTALL_NAME_DIR ${CMAKE_BINARY_DIR}/output/lib)
375+
ELSE (ENABLE_TESTS)
376+
SET (CMAKE_INSTALL_NAME_DIR @executable_path/${QGIS_FW_SUBDIR})
377+
ENDIF (ENABLE_TESTS)
374378
IF (WITH_GLOBE)
375379
SET (OSG_PLUGINS_PATH "" CACHE PATH "Path to OSG plugins for bundling")
376380
ENDIF (WITH_GLOBE)
@@ -457,6 +461,13 @@ SET (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${QGIS_OUTPUT_DIRECTORY}/${QGIS_LIB_SUBDIR})
457461
# if run from the build directory QGIS will detect it and alter the paths
458462
FILE(WRITE ${QGIS_OUTPUT_DIRECTORY}/${QGIS_BIN_SUBDIR}/source_path.txt "${CMAKE_SOURCE_DIR}")
459463

464+
# symlink provider plugins dir for Mac unit tests
465+
IF (APPLE AND ENABLE_TESTS)
466+
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E create_symlink
467+
"${CMAKE_CURRENT_BINARY_DIR}/Plugins"
468+
"${CMAKE_CURRENT_BINARY_DIR}/output/Plugins")
469+
ENDIF (APPLE AND ENABLE_TESTS)
470+
460471
# manual page - makes sense only on unix systems
461472
IF (UNIX AND NOT APPLE)
462473
SET (DEFAULT_MANUAL_SUBDIR man)

0 commit comments

Comments
 (0)