Skip to content

Commit 41b5453

Browse files
committed
Use CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT
This lets us set the install prefix to the build directory *unless* the user has explicitly provided something else. Before this commit, it was impossible to change the install prefix.
1 parent 4108ab9 commit 41b5453

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

CMakeLists.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
1414
set(CMAKE_CXX_EXTENSIONS OFF)
1515

1616
# Install to the build directory
17-
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}" CACHE STRING "CMake install prefix" FORCE)
17+
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
18+
set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}" CACHE STRING "CMake install prefix" FORCE)
19+
endif()
1820

1921
# Use "d" suffix for debug builds
2022
# Do not use a suffix for RelWithDebInfo

0 commit comments

Comments
 (0)