Introduce a variable to identify in-source build
[alexxy/gromacs.git] / cmake / gmxVersionInfo.cmake
index 6430211f29ef31c8f5be264db98ab49345e91246..c37b8cad674505d784fdf7b0f91c818975e046c4 100644 (file)
@@ -83,6 +83,8 @@
 #   SOURCE_IS_GIT_REPOSITORY       The source tree is a git repository.
 # Note that both can be false if the tree has been extracted, e.g., as a
 # tarball directly from git.
+# Additionally, the following variable is defined:
+#   BUILD_IS_INSOURCE              The build is happening in-source.
 #
 # This script also declares machinery to generate and obtain version
 # information from a git repository.  This is enabled by default if the source
@@ -185,6 +187,10 @@ endif()
 if (NOT EXISTS "${PROJECT_SOURCE_DIR}/admin/.isreposource")
     set(SOURCE_IS_SOURCE_DISTRIBUTION ON)
 endif()
+set(BUILD_IS_INSOURCE OFF)
+if ("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}")
+    set(BUILD_IS_INSOURCE ON)
+endif()
 
 #####################################################################
 # Manually maintained version info