From 08637912532b7c83a151d35cefe396520df8c3c8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=B6rg=20Mayer?= Date: Tue, 8 Oct 2013 20:41:57 +0000 Subject: [PATCH] Try to set PATH on Windows to all required dlls/libs to allow running the executables from the build tree without installation. It doesn't really work yet but the troubleshooting has to wait until either I've gotten some sleep or someone else fixes it. svn path=/trunk/; revision=52454 --- CMakeLists.txt | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0db66a83af..a60e8b1b44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -455,6 +455,7 @@ foreach(PACKAGE ${PACKAGELIST}) if (${PACKAGE_VAR}_FOUND) set(HAVE_LIB${PACKAGE_VAR} 1) include_directories(${${PACKAGE_VAR}_INCLUDE_DIRS}) + set(WS_ALL_LIBS ${WS_ALL_LIBS} ${${PACKAGE_VAR}_LIBRARIES}) message(STATUS "${PACKAGE} includes: ${${PACKAGE_VAR}_INCLUDE_DIRS}") message(STATUS "${PACKAGE} libs: ${${PACKAGE_VAR}_LIBRARIES}") if (${PACKAGE}_DEFINITIONS) @@ -466,6 +467,27 @@ foreach(PACKAGE ${PACKAGELIST}) endif() endforeach() +# Add paths required to run the executables inside the build dir + +if(WIN32) + if( "$ENV{PATH}" MATCHES "${CMAKE_BINARY_DIR}/lib") + message( STATUS "Build dir (${CMAKE_BINARY_DIR}/lib) already in path." ) + else() + # message( STATUS "All libs: ${WS_ALL_LIBS}\n" ) + foreach( THIS_LIB_PATH ${WS_ALL_LIBS} ) + get_filename_component( LIB_PATH ${THIS_LIB_PATH} PATH ) + # message( STATUS "Raw path ${THIS_LIB_PATH} processed to ${LIB_PATH}." ) + set( WS_LOCAL_LIB_PATHS ${WS_LOCAL_LIB_PATHS} ${LIB_PATH} ) + endforeach() + list(REMOVE_DUPLICATES WS_LOCAL_LIB_PATHS) + # All generated libs go here, so start our libsearch in this place + set(WS_LOCAL_LIB_PATHS "${CMAKE_BINARY_DIR}/lib" ${WS_LOCAL_LIB_PATHS}) + message( STATUS "Adding paths: ${WS_LOCAL_LIB_PATHS}" ) + set( ENV{PATH} $ENV{PATH} ${WS_LOCAL_LIB_PATHS} ) + endif() +endif() + + # Provide Windows system lib names include( UseWinLibs ) -- 2.34.1