option(GMX_BUILD_HELP "Build man pages, HTML help, and completions automatically (requires that compiled binaries can be executed on the build host)" OFF)
mark_as_advanced(GMX_BUILD_HELP)
-if (GMX_BUILD_HELP AND SOURCE_IS_SOURCE_DISTRIBUTION AND
- "${CMAKE_CURRENT_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
-
+if (GMX_BUILD_HELP AND SOURCE_IS_SOURCE_DISTRIBUTION AND BUILD_IS_INSOURCE)
message(FATAL_ERROR
"Rebuilding HTML and man pages is not supported for in-source "
"builds from a source distribution. "
# 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
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
set(HTML_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/html")
file(MAKE_DIRECTORY ${HTML_OUTPUT_DIR})
-if(${CMAKE_CURRENT_BINARY_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
+if (BUILD_IS_INSOURCE)
set(MARKDOWN_CONFIGURE_IS_POSSIBLE off)
else()
set(MARKDOWN_CONFIGURE_IS_POSSIBLE on)
# never need to know.
if(GMX_BUILD_WEBPAGE AND
GMX_BUILD_HELP AND
- NOT ${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR} AND
+ NOT BUILD_IS_INSOURCE AND
MARKDOWN_CONFIGURE_IS_POSSIBLE AND
MANUAL_BUILD_IS_POSSIBLE AND
PANDOC_EXECUTABLE AND
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
-if(${CMAKE_BINARY_DIR} STREQUAL ${CMAKE_SOURCE_DIR})
+if (BUILD_IS_INSOURCE)
# UseLATEX.cmake does not work with an in-source build
message(STATUS "Cannot build the manual when building in the source directory")
set(MANUAL_BUILD_IS_POSSIBLE OFF)