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