1 # 2 # win32 macros 3 # 4 # Copyright (c) 2006-2007, Ralf Habacker 5 # 6 # Redistribution and use is allowed according to the terms of the BSD license. 7 # 8 9 if (WIN32) 10 # 11 # addExplorerWrapper creates batch files for fast access 12 # to the build environment from the win32 explorer. 13 # 14 # For mingw and nmake projects it's opens a command shell, 15 # for Visual Studio IDE's (at least tested with VS 8 2005) it 16 # opens the related .sln file with paths setting specified at 17 # configure time. 18 # 19 MACRO (addExplorerWrapper _projectname) 20 # write explorer wrappers 21 get_filename_component(CMAKE_BIN_PATH ${CMAKE_COMMAND} PATH) 22 set (ADD_PATH "${CMAKE_BIN_PATH}") 23 24 if (QT_QMAKE_EXECUTABLE) 25 get_filename_component(QT_BIN_PATH ${QT_QMAKE_EXECUTABLE} PATH) 26 set (ADD_PATH "${ADD_PATH};${QT_BIN_PATH}") 27 endif (QT_QMAKE_EXECUTABLE) 28 29 # add here more pathes 30 31 if (MINGW) 32 get_filename_component(MINGW_BIN_PATH ${CMAKE_CXX_COMPILER} PATH) 33 set (ADD_PATH "${ADD_PATH};${MINGW_BIN_PATH}") 34 write_file (${CMAKE_BINARY_DIR}/${_projectname}-shell.bat "set PATH=${ADD_PATH};%PATH%\ncmd.exe") 35 else (MINGW) 36 if (CMAKE_BUILD_TOOL STREQUAL "nmake") 37 get_filename_component(VC_BIN_PATH ${CMAKE_CXX_COMPILER} PATH) 38 write_file (${CMAKE_BINARY_DIR}/${_projectname}-shell.bat "set PATH=${ADD_PATH};%PATH%\ncall \"${VC_BIN_PATH}\\vcvars32.bat\"\ncmd.exe") 39 else (CMAKE_BUILD_TOOL STREQUAL "nmake") 40 write_file (${CMAKE_BINARY_DIR}/${_projectname}-sln.bat "set PATH=${ADD_PATH};%PATH%\nstart ${_projectname}.sln") 41 endif (CMAKE_BUILD_TOOL STREQUAL "nmake") 42 endif (MINGW) 43 ENDMACRO (addExplorerWrapper) 44 endif(WIN32) 45