Skip to content

Commit

Permalink
add option to force different build directory than source directory
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed May 26, 2019
1 parent ab23ac4 commit 16727b5
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions CMakeLists.txt
Expand Up @@ -174,7 +174,7 @@ message(STATUS "cmake: ${CMAKE_VERSION}")
# ================= All the options for the build process =================
# ==============================================================================

# Switch to build FreeCAD with Qt5
option(BUILD_FORCE_DIRECTORY "The build directory must be different to the source directory." OFF)
option(BUILD_GUI "Build FreeCAD Gui. Otherwise you have only the command line and the Python import module." ON)
option(FREECAD_USE_EXTERNAL_ZIPIOS "Use system installed zipios++ instead of the bundled." OFF)
option(FREECAD_USE_EXTERNAL_SMESH "Use system installed smesh instead of the bundled." OFF)
Expand Down Expand Up @@ -360,6 +360,14 @@ if(WIN32 AND CMAKE_VERSION VERSION_LESS 3.4.3)
set(BUILD_PATH OFF)
endif()

# force build directory to be different to source directory
if (BUILD_FORCE_DIRECTORY)
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR "The build directory (${CMAKE_BINARY_DIR}) must be different to the source directory (${CMAKE_SOURCE_DIR}).\n"
"Please choose another build directory! Or disable the option BUILD_FORCE_DIRECTORY.")
endif()
endif()

# ==============================================================================
#inter-module dependencies

Expand Down Expand Up @@ -1238,14 +1246,8 @@ if(MINGW)
link_libraries(-lgdi32)
endif(MINGW)

# force build directory to be different to source directory
#if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
#message(SEND_ERROR "The build directory (${CMAKE_BINARY_DIR}) must be different to the source directory "
# "(${CMAKE_SOURCE_DIR}). Please choose another build directory!")
#elseif()
add_subdirectory(src)
add_subdirectory(data)
#endif()

# ================================================================================
# == Packaging ===================================================================
Expand Down

0 comments on commit 16727b5

Please sign in to comment.