Skip to content

Commit

Permalink
Make windows install to Documents directory.
Browse files Browse the repository at this point in the history
  • Loading branch information
kuzi117 committed Sep 12, 2017
1 parent 6901d7d commit 90b194a
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cmake/install_dirs.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
# */include/sc2api/sc2api/. sc2_api.h is still included via
# # include <sc2api/sc2_api.h>

# If on windows we want to install to the StarCraft II User's Document folder
# https://github.com/Blizzard/s2client-api/issues/90#issuecomment-325395402
if(WIN32 AND NOT CYGWIN)
set(SC2API_OLD_CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
get_filename_component(CMAKE_INSTALL_PREFIX "$ENV{USERPROFILE}/Documents/StarCraft II" ABSOLUTE)
endif()

# Set up lib, bin, include install destination dirs
set(
SC2API_INSTALL_LIB_DIR
Expand All @@ -36,7 +43,7 @@ set(

# Choose our cmake file install dir based on OS
if(WIN32 AND NOT CYGWIN)
set(DEF_INSTALL_CMAKE_DIR cmake)
set(DEF_INSTALL_CMAKE_DIR CMake)
else()
set(DEF_INSTALL_CMAKE_DIR lib/cmake/SC2API)
endif()
Expand All @@ -57,3 +64,8 @@ foreach(p LIB BIN INCLUDE CMAKE)
set(${var} "${CMAKE_INSTALL_PREFIX}/${${var}}")
endif()
endforeach()

# Reset CMAKE_INSTALL_PREFIX to not affect super projects who potentially use it...
if (WIN32 AND NOT CYGWIN)
set(CMAKE_INSTALL_PREFIX ${OLD_PREFIX})
endif()

0 comments on commit 90b194a

Please sign in to comment.