Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated CMake files to use CMAKE_CURRENT_SOURCE_DIR #15539

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmake/fmtlib.cmake
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
include(${CMAKE_SOURCE_DIR}/cmake/submodules.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/submodules.cmake)
initialize_submodule(fmtlib)

set(FMT_SYSTEM_HEADERS ON)
add_subdirectory(
${CMAKE_SOURCE_DIR}/deps/fmtlib
${CMAKE_CURRENT_SOURCE_DIR}/deps/fmtlib
EXCLUDE_FROM_ALL
)

4 changes: 2 additions & 2 deletions cmake/nlohmann-json.cmake
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
include(${CMAKE_SOURCE_DIR}/cmake/submodules.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/submodules.cmake)
initialize_submodule(nlohmann-json)

set(JSON_Install OFF CACHE INTERNAL "")
add_subdirectory(
${CMAKE_SOURCE_DIR}/deps/nlohmann-json
${CMAKE_CURRENT_SOURCE_DIR}/deps/nlohmann-json
EXCLUDE_FROM_ALL
)

6 changes: 3 additions & 3 deletions cmake/range-v3.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
include(${CMAKE_SOURCE_DIR}/cmake/submodules.cmake)
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/submodules.cmake)
initialize_submodule(range-v3)

add_library(range-v3 INTERFACE IMPORTED)
set_target_properties(range-v3 PROPERTIES
INTERFACE_COMPILE_OPTIONS "\$<\$<CXX_COMPILER_ID:MSVC>:/permissive->"
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${CMAKE_SOURCE_DIR}/deps/range-v3/include
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_SOURCE_DIR}/deps/range-v3/include
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/deps/range-v3/include
INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/deps/range-v3/include
)
add_dependencies(range-v3 range-v3-project)

2 changes: 1 addition & 1 deletion cmake/scripts/buildinfo.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# generates BuildInfo.h
#
# this module expects
# ETH_SOURCE_DIR - main CMAKE_SOURCE_DIR
# ETH_SOURCE_DIR - main CMAKE_CURRENT_SOURCE_DIR
# ETH_DST_DIR - main CMAKE_BINARY_DIR
# ETH_BUILD_TYPE
# ETH_BUILD_PLATFORM
Expand Down
8 changes: 4 additions & 4 deletions cmake/submodules.cmake
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
macro(initialize_submodule SUBMODULE_PATH)
if(NOT IGNORE_VENDORED_DEPENDENCIES)
file(GLOB submodule_contents "${CMAKE_SOURCE_DIR}/deps/${SUBMODULE_PATH}/*")
file(GLOB submodule_contents "${CMAKE_CURRENT_SOURCE_DIR}/deps/${SUBMODULE_PATH}/*")

if(submodule_contents)
message(STATUS "git submodule '${SUBMODULE_PATH}' seem to be already initialized: nothing to do.")
else()
message(STATUS "git submodule '${SUBMODULE_PATH}' seem not to be initialized: implicitly executing 'git submodule update --init '${CMAKE_SOURCE_DIR}/deps/${SUBMODULE_PATH}'.")
message(STATUS "git submodule '${SUBMODULE_PATH}' seem not to be initialized: implicitly executing 'git submodule update --init '${CMAKE_CURRENT_SOURCE_DIR}/deps/${SUBMODULE_PATH}'.")
find_package(Git)
if(NOT Git_FOUND)
message(FATAL_ERROR "Failed to initialize submodules: 'git' command not found.")
endif()
execute_process(
COMMAND git submodule update --init ${CMAKE_SOURCE_DIR}/deps/${SUBMODULE_PATH}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
COMMAND git submodule update --init ${CMAKE_CURRENT_SOURCE_DIR}/deps/${SUBMODULE_PATH}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
RESULT_VARIABLE result
)
if(NOT result EQUAL 0)
Expand Down