Skip to content
Snippets Groups Projects
Commit 65ba2bbf authored by Max Lyon's avatar Max Lyon
Browse files

add Option to disable in-source

parent 5db8eb0a
No related branches found
No related tags found
1 merge request!1VCI Common
......@@ -3,10 +3,20 @@ if (EXISTS ${CMAKE_SOURCE_DIR}/${CMAKE_PROJECT_NAME}.cmake)
endif ()
# prevent build in source directory
# add option to disable in-source build
option (
BLOCK_IN_SOURCE_BUILD
"Disable building inside the source tree"
ON
)
if ( BLOCK_IN_SOURCE_BUILD )
if ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
message (SEND_ERROR "Building in the source directory is not supported.")
message (FATAL_ERROR "Please remove the created \"CMakeCache.txt\" file, the \"CMakeFiles\" directory and create a build directory and call \"${CMAKE_COMMAND} <path to the sources>\".")
endif ("${CMAKE_BINARY_DIR}" STREQUAL "${CMAKE_SOURCE_DIR}")
endif()
# allow only Debug and Release builds
set (CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment