Skip to content

Commit 90b194a

Browse files
committed
Make windows install to Documents directory.
1 parent 6901d7d commit 90b194a

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

cmake/install_dirs.cmake

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@
1111
# */include/sc2api/sc2api/. sc2_api.h is still included via
1212
# # include <sc2api/sc2_api.h>
1313

14+
# If on windows we want to install to the StarCraft II User's Document folder
15+
# https://github.com/Blizzard/s2client-api/issues/90#issuecomment-325395402
16+
if(WIN32 AND NOT CYGWIN)
17+
set(SC2API_OLD_CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
18+
get_filename_component(CMAKE_INSTALL_PREFIX "$ENV{USERPROFILE}/Documents/StarCraft II" ABSOLUTE)
19+
endif()
20+
1421
# Set up lib, bin, include install destination dirs
1522
set(
1623
SC2API_INSTALL_LIB_DIR
@@ -36,7 +43,7 @@ set(
3643

3744
# Choose our cmake file install dir based on OS
3845
if(WIN32 AND NOT CYGWIN)
39-
set(DEF_INSTALL_CMAKE_DIR cmake)
46+
set(DEF_INSTALL_CMAKE_DIR CMake)
4047
else()
4148
set(DEF_INSTALL_CMAKE_DIR lib/cmake/SC2API)
4249
endif()
@@ -57,3 +64,8 @@ foreach(p LIB BIN INCLUDE CMAKE)
5764
set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
5865
endif()
5966
endforeach()
67+
68+
# Reset CMAKE_INSTALL_PREFIX to not affect super projects who potentially use it...
69+
if (WIN32 AND NOT CYGWIN)
70+
set(CMAKE_INSTALL_PREFIX ${OLD_PREFIX})
71+
endif()

0 commit comments

Comments
 (0)