summaryrefslogtreecommitdiffhomepage
path: root/cmake
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2017-01-13 21:29:48 +0100
committerStanislaw Halik <sthalik@misaki.pl>2017-01-13 21:29:48 +0100
commit7919ba32fb4608a008f8947888b1a53e90ce6c56 (patch)
treecf8b6e7734f8e9dae69dfd32c94c947deb7091cd /cmake
parentf05970713bc2a150c8fa76c073362ff93c41c5ba (diff)
cmake: find editbin with Visual Studio .sln generator
Diffstat (limited to 'cmake')
-rw-r--r--cmake/opentrack-qt.cmake22
1 files changed, 19 insertions, 3 deletions
diff --git a/cmake/opentrack-qt.cmake b/cmake/opentrack-qt.cmake
index 38ef8b94..5b851508 100644
--- a/cmake/opentrack-qt.cmake
+++ b/cmake/opentrack-qt.cmake
@@ -12,12 +12,28 @@ if(WIN32)
endif()
string(FIND "${CMAKE_GENERATOR}" "Visual Studio " is-msvc)
+if(is-msvc EQUAL 0)
+ set(is-msvc TRUE)
+else()
+ set(is-msvc FALSE)
+endif()
+
+if(MSVC)
+ # on .sln generator we have no editbin in path
+ if(is-msvc)
+ # this is bad but what can we do? searching for vcvarsall.bat
+ # would be easier, but then we'd have to differentiate x86/amd64
+ # cross tools, etc. which is a can of worms and if/else branches.
+ get_filename_component(linker-dir "${CMAKE_LINKER}" DIRECTORY)
+ find_file(editbin-executable-filepath "editbin.exe" "${linker-dir}" "${linker-dir}/.." "${linker-dir}/../..")
+ opentrack_escape_string("${editbin-executable-filepath}" editbin-executable)
+ else()
+ set(editbin-executable "editbin")
+ endif()
-# on .sln generator we have no editbin path ready
-if(MSVC AND NOT is-msvc EQUAL 0)
install(CODE "
foreach(i Qt5Core Qt5Gui Qt5Network Qt5SerialPort Qt5Widgets platforms/qwindows)
- execute_process(COMMAND editbin -nologo -SUBSYSTEM:WINDOWS,5.01 -OSVERSION:5.1 \"\${i}.dll\" WORKING_DIRECTORY \"\${CMAKE_INSTALL_PREFIX}\")
+ execute_process(COMMAND \"${editbin-executable}\" -nologo -SUBSYSTEM:WINDOWS,5.01 -OSVERSION:5.1 \"\${i}.dll\" WORKING_DIRECTORY \"\${CMAKE_INSTALL_PREFIX}\")
endforeach()
")
endif()