Skip to content

Commit 6ef3842

Browse files
committed
fix prefix path setting: enable running from from build directory
1 parent d679255 commit 6ef3842

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

‎src/server/qgsserver.cpp‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -284,13 +284,16 @@ bool QgsServer::init( )
284284
QCoreApplication::setOrganizationDomain( QgsApplication::QGIS_ORGANIZATION_DOMAIN );
285285
QCoreApplication::setApplicationName( QgsApplication::QGIS_APPLICATION_NAME );
286286

287-
//Default prefix path may be altered by environment variable
288-
QgsApplication::init();
289287
#if !defined(Q_OS_WIN)
290-
// init QGIS's paths - true means that all path will be inited from prefix
291-
QgsApplication::setPrefixPath( CMAKE_INSTALL_PREFIX, true );
288+
// Set the QGIS_PREFIX_PATH environnemnt instead of calling directly
289+
// setPrefixPath: this will allow running server from build directory
290+
// and get the paths accordingly
291+
setenv( "QGIS_PREFIX_PATH", CMAKE_INSTALL_PREFIX, 1 );
292292
#endif
293293

294+
//Default prefix path may be altered by environment variable
295+
QgsApplication::init();
296+
294297
#if defined(SERVER_SKIP_ECW)
295298
QgsMessageLog::logMessage( "Skipping GDAL ECW drivers in server.", "Server", QgsMessageLog::INFO );
296299
QgsApplication::skipGdalDriver( "ECW" );

0 commit comments

Comments
 (0)