Skip to content

Commit 81d2f0f

Browse files
committed
[cmake][win] Change the default CMAKE_INSTALL_PREFIX
Change the default install prefix from "C:/Program Files/${PROJECT_NAME}" to "C:/${PROJECT_NAME}-${ROOT_MAJOR_VERSION}-${ROOT_MINOR_VERSION}-${ROOT_PATCH_VERSION}" to prevent having (unsupported) spaces in the install PATH
1 parent d74cccc commit 81d2f0f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cmake/modules/SetUpWindows.cmake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ if(CMAKE_COMPILER_IS_GNUCXX)
1818
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--no-undefined")
1919

2020
elseif(MSVC)
21+
22+
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
23+
# Change the default install from "C:/Program Files/${PROJECT_NAME}" to
24+
# "C:/${PROJECT_NAME}-${ROOT_MAJOR_VERSION}-${ROOT_MINOR_VERSION}-${ROOT_PATCH_VERSION}"
25+
# to prevent having (unsupported) spaces in the install PATH
26+
set (CMAKE_INSTALL_PREFIX "C:/${PROJECT_NAME}-${ROOT_MAJOR_VERSION}-${ROOT_MINOR_VERSION}-${ROOT_PATCH_VERSION}"
27+
CACHE PATH "default install path" FORCE)
28+
endif()
29+
2130
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
2231
set(ARCH "-wd4267")
2332
set(ROOT_ARCHITECTURE win64)

0 commit comments

Comments
 (0)