Make Memgraph work with fetch content (#256)

This commit is contained in:
Antonio Andelic 2021-10-14 18:58:42 +02:00 committed by GitHub
parent 6033fbe9bd
commit df689dccd5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 33 deletions

View File

@ -66,7 +66,7 @@ if (MG_ENTERPRISE)
else()
set(get_version_offering "--open-source")
endif()
set(get_version_script "${CMAKE_SOURCE_DIR}/release/get_version.py")
set(get_version_script "${CMAKE_CURRENT_SOURCE_DIR}/release/get_version.py")
# Get version that should be used in the binary.
execute_process(
@ -76,7 +76,7 @@ execute_process(
"${MEMGRAPH_OVERRIDE_VERSION}"
"${MEMGRAPH_OVERRIDE_VERSION_SUFFIX}"
"--memgraph-root-dir"
"${CMAKE_SOURCE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}"
)
if(MEMGRAPH_VERSION_RESULT AND NOT MEMGRAPH_VERSION_RESULT EQUAL 0)
message(FATAL_ERROR "Unable to get Memgraph version.")
@ -93,7 +93,7 @@ execute_process(
"${MEMGRAPH_OVERRIDE_VERSION}"
"${MEMGRAPH_OVERRIDE_VERSION_SUFFIX}"
"--memgraph-root-dir"
"${CMAKE_SOURCE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}"
)
if(MEMGRAPH_VERSION_DEB_RESULT AND NOT MEMGRAPH_VERSION_DEB_RESULT EQUAL 0)
message(FATAL_ERROR "Unable to get Memgraph DEB version.")
@ -110,7 +110,7 @@ execute_process(
"${MEMGRAPH_OVERRIDE_VERSION}"
"${MEMGRAPH_OVERRIDE_VERSION_SUFFIX}"
"--memgraph-root-dir"
"${CMAKE_SOURCE_DIR}"
"${CMAKE_CURRENT_SOURCE_DIR}"
)
if(MEMGRAPH_VERSION_RPM_RESULT AND NOT MEMGRAPH_VERSION_RPM_RESULT EQUAL 0)
message(FATAL_ERROR "Unable to get Memgraph RPM version.")
@ -331,8 +331,13 @@ add_subdirectory(src)
# Release configuration
add_subdirectory(release)
enable_testing()
add_subdirectory(tests)
option(MG_ENABLE_TESTING "Set this to OFF to disable building test binaries" ON)
message(STATUS "MG_ENABLE_TESTING: ${MG_ENABLE_TESTING}")
if (MG_ENABLE_TESTING)
enable_testing()
add_subdirectory(tests)
endif()
if(TOOLS)
add_subdirectory(tools)

View File

@ -2,19 +2,19 @@
# Don't forget to repeat this list below in `define_add_lcp`.
set(lcp_src_files
${CMAKE_SOURCE_DIR}/src/lisp/lcp.asd
${CMAKE_SOURCE_DIR}/src/lisp/compile-lcp
${CMAKE_SOURCE_DIR}/src/lisp/package.lisp
${CMAKE_SOURCE_DIR}/src/lisp/names.lisp
${CMAKE_SOURCE_DIR}/src/lisp/types.lisp
${CMAKE_SOURCE_DIR}/src/lisp/clone.lisp
${CMAKE_SOURCE_DIR}/src/lisp/code-gen.lisp
${CMAKE_SOURCE_DIR}/src/lisp/slk.lisp
${CMAKE_SOURCE_DIR}/src/lisp/lcp.lisp
${CMAKE_SOURCE_DIR}/src/lisp/debug.lisp
${CMAKE_SOURCE_DIR}/src/lisp/test.lisp
${CMAKE_SOURCE_DIR}/src/lisp/util.lisp
${CMAKE_SOURCE_DIR}/tools/lcp)
${PROJECT_SOURCE_DIR}/src/lisp/lcp.asd
${PROJECT_SOURCE_DIR}/src/lisp/compile-lcp
${PROJECT_SOURCE_DIR}/src/lisp/package.lisp
${PROJECT_SOURCE_DIR}/src/lisp/names.lisp
${PROJECT_SOURCE_DIR}/src/lisp/types.lisp
${PROJECT_SOURCE_DIR}/src/lisp/clone.lisp
${PROJECT_SOURCE_DIR}/src/lisp/code-gen.lisp
${PROJECT_SOURCE_DIR}/src/lisp/slk.lisp
${PROJECT_SOURCE_DIR}/src/lisp/lcp.lisp
${PROJECT_SOURCE_DIR}/src/lisp/debug.lisp
${PROJECT_SOURCE_DIR}/src/lisp/test.lisp
${PROJECT_SOURCE_DIR}/src/lisp/util.lisp
${PROJECT_SOURCE_DIR}/tools/lcp)
# Make `lcp_src_files` a persistent (cache) variable so that
# tests/unit/CMakeLists.txt can see it.
@ -65,21 +65,21 @@ macro(define_add_lcp name main_src_files generated_lcp_files)
# Repeat the `lcp_src_files` because this is a macro and the variable is
# not visible when invoked in another file.
set(lcp_src_files
${CMAKE_SOURCE_DIR}/src/lisp/lcp.asd
${CMAKE_SOURCE_DIR}/src/lisp/compile-lcp
${CMAKE_SOURCE_DIR}/src/lisp/package.lisp
${CMAKE_SOURCE_DIR}/src/lisp/names.lisp
${CMAKE_SOURCE_DIR}/src/lisp/types.lisp
${CMAKE_SOURCE_DIR}/src/lisp/clone.lisp
${CMAKE_SOURCE_DIR}/src/lisp/code-gen.lisp
${CMAKE_SOURCE_DIR}/src/lisp/slk.lisp
${CMAKE_SOURCE_DIR}/src/lisp/lcp.lisp
${CMAKE_SOURCE_DIR}/src/lisp/debug.lisp
${CMAKE_SOURCE_DIR}/src/lisp/test.lisp
${CMAKE_SOURCE_DIR}/src/lisp/util.lisp
${CMAKE_SOURCE_DIR}/tools/lcp)
${PROJECT_SOURCE_DIR}/src/lisp/lcp.asd
${PROJECT_SOURCE_DIR}/src/lisp/compile-lcp
${PROJECT_SOURCE_DIR}/src/lisp/package.lisp
${PROJECT_SOURCE_DIR}/src/lisp/names.lisp
${PROJECT_SOURCE_DIR}/src/lisp/types.lisp
${PROJECT_SOURCE_DIR}/src/lisp/clone.lisp
${PROJECT_SOURCE_DIR}/src/lisp/code-gen.lisp
${PROJECT_SOURCE_DIR}/src/lisp/slk.lisp
${PROJECT_SOURCE_DIR}/src/lisp/lcp.lisp
${PROJECT_SOURCE_DIR}/src/lisp/debug.lisp
${PROJECT_SOURCE_DIR}/src/lisp/test.lisp
${PROJECT_SOURCE_DIR}/src/lisp/util.lisp
${PROJECT_SOURCE_DIR}/tools/lcp)
add_custom_command(OUTPUT ${h_file} ${cpp_file}
COMMAND ${CMAKE_SOURCE_DIR}/tools/lcp ${lcp_file} ${slk_serialize}
COMMAND ${PROJECT_SOURCE_DIR}/tools/lcp ${lcp_file} ${slk_serialize}
VERBATIM
DEPENDS ${lcp_src_files} lcp ${lcp_file}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})