mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #14313 from junaire/fix-wrong-cmake-variable
Fix incorrect CMAKE_SOURCE_DIR usage
This commit is contained in:
commit
d32aef3fea
@ -5,7 +5,7 @@ list(APPEND CMAKE_MODULE_PATH ${ETH_CMAKE_DIR})
|
|||||||
|
|
||||||
# Set the build type, if none was specified.
|
# Set the build type, if none was specified.
|
||||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||||
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
|
if(EXISTS "${PROJECT_SOURCE_DIR}/.git")
|
||||||
set(DEFAULT_BUILD_TYPE "RelWithDebInfo")
|
set(DEFAULT_BUILD_TYPE "RelWithDebInfo")
|
||||||
else()
|
else()
|
||||||
set(DEFAULT_BUILD_TYPE "Release")
|
set(DEFAULT_BUILD_TYPE "Release")
|
||||||
@ -66,12 +66,12 @@ include(EthUtils)
|
|||||||
|
|
||||||
# Create license.h from LICENSE.txt and template
|
# Create license.h from LICENSE.txt and template
|
||||||
# Converting to char array is required due to MSVC's string size limit.
|
# Converting to char array is required due to MSVC's string size limit.
|
||||||
file(READ ${CMAKE_SOURCE_DIR}/LICENSE.txt LICENSE_TEXT HEX)
|
file(READ ${PROJECT_SOURCE_DIR}/LICENSE.txt LICENSE_TEXT HEX)
|
||||||
string(REGEX MATCHALL ".." LICENSE_TEXT "${LICENSE_TEXT}")
|
string(REGEX MATCHALL ".." LICENSE_TEXT "${LICENSE_TEXT}")
|
||||||
string(REGEX REPLACE ";" ",\n\t0x" LICENSE_TEXT "${LICENSE_TEXT}")
|
string(REGEX REPLACE ";" ",\n\t0x" LICENSE_TEXT "${LICENSE_TEXT}")
|
||||||
set(LICENSE_TEXT "0x${LICENSE_TEXT}")
|
set(LICENSE_TEXT "0x${LICENSE_TEXT}")
|
||||||
|
|
||||||
configure_file("${CMAKE_SOURCE_DIR}/cmake/templates/license.h.in" include/license.h)
|
configure_file("${PROJECT_SOURCE_DIR}/cmake/templates/license.h.in" include/license.h)
|
||||||
|
|
||||||
include(EthOptions)
|
include(EthOptions)
|
||||||
configure_project(TESTS)
|
configure_project(TESTS)
|
||||||
|
@ -28,7 +28,7 @@ if(PEDANTIC)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Prevent the path of the source directory from ending up in the binary via __FILE__ macros.
|
# Prevent the path of the source directory from ending up in the binary via __FILE__ macros.
|
||||||
eth_add_cxx_compiler_flag_if_supported("-fmacro-prefix-map=${CMAKE_SOURCE_DIR}=/solidity")
|
eth_add_cxx_compiler_flag_if_supported("-fmacro-prefix-map=${PROJECT_SOURCE_DIR}=/solidity")
|
||||||
|
|
||||||
# -Wpessimizing-move warns when a call to std::move would prevent copy elision
|
# -Wpessimizing-move warns when a call to std::move would prevent copy elision
|
||||||
# if the argument was not wrapped in a call. This happens when moving a local
|
# if the argument was not wrapped in a call. This happens when moving a local
|
||||||
|
@ -2,8 +2,8 @@ include(FetchContent)
|
|||||||
|
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
fmtlib
|
fmtlib
|
||||||
PREFIX "${CMAKE_BINARY_DIR}/deps"
|
PREFIX "${PROJECT_BINARY_DIR}/deps"
|
||||||
DOWNLOAD_DIR "${CMAKE_SOURCE_DIR}/deps/downloads"
|
DOWNLOAD_DIR "${PROJECT_SOURCE_DIR}/deps/downloads"
|
||||||
DOWNLOAD_NAME fmt-8.0.1.tar.gz
|
DOWNLOAD_NAME fmt-8.0.1.tar.gz
|
||||||
URL https://github.com/fmtlib/fmt/archive/8.0.1.tar.gz
|
URL https://github.com/fmtlib/fmt/archive/8.0.1.tar.gz
|
||||||
URL_HASH SHA256=b06ca3130158c625848f3fb7418f235155a4d389b2abc3a6245fb01cb0eb1e01
|
URL_HASH SHA256=b06ca3130158c625848f3fb7418f235155a4d389b2abc3a6245fb01cb0eb1e01
|
||||||
|
@ -6,7 +6,7 @@ else()
|
|||||||
set(JSONCPP_CMAKE_COMMAND ${CMAKE_COMMAND})
|
set(JSONCPP_CMAKE_COMMAND ${CMAKE_COMMAND})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(prefix "${CMAKE_BINARY_DIR}/deps")
|
set(prefix "${PROJECT_BINARY_DIR}/deps")
|
||||||
set(JSONCPP_LIBRARY "${prefix}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}jsoncpp${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
set(JSONCPP_LIBRARY "${prefix}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}jsoncpp${CMAKE_STATIC_LIBRARY_SUFFIX}")
|
||||||
set(JSONCPP_INCLUDE_DIR "${prefix}/include")
|
set(JSONCPP_INCLUDE_DIR "${prefix}/include")
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ endif()
|
|||||||
|
|
||||||
ExternalProject_Add(jsoncpp-project
|
ExternalProject_Add(jsoncpp-project
|
||||||
PREFIX "${prefix}"
|
PREFIX "${prefix}"
|
||||||
DOWNLOAD_DIR "${CMAKE_SOURCE_DIR}/deps/downloads"
|
DOWNLOAD_DIR "${PROJECT_SOURCE_DIR}/deps/downloads"
|
||||||
DOWNLOAD_NAME jsoncpp-1.9.3.tar.gz
|
DOWNLOAD_NAME jsoncpp-1.9.3.tar.gz
|
||||||
URL https://github.com/open-source-parsers/jsoncpp/archive/1.9.3.tar.gz
|
URL https://github.com/open-source-parsers/jsoncpp/archive/1.9.3.tar.gz
|
||||||
URL_HASH SHA256=8593c1d69e703563d94d8c12244e2e18893eeb9a8a9f8aa3d09a327aa45c8f7d
|
URL_HASH SHA256=8593c1d69e703563d94d8c12244e2e18893eeb9a8a9f8aa3d09a327aa45c8f7d
|
||||||
|
@ -6,12 +6,12 @@ else()
|
|||||||
set(RANGE_V3_CMAKE_COMMAND ${CMAKE_COMMAND})
|
set(RANGE_V3_CMAKE_COMMAND ${CMAKE_COMMAND})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(prefix "${CMAKE_BINARY_DIR}/deps")
|
set(prefix "${PROJECT_BINARY_DIR}/deps")
|
||||||
set(RANGE_V3_INCLUDE_DIR "${prefix}/include")
|
set(RANGE_V3_INCLUDE_DIR "${prefix}/include")
|
||||||
|
|
||||||
ExternalProject_Add(range-v3-project
|
ExternalProject_Add(range-v3-project
|
||||||
PREFIX "${prefix}"
|
PREFIX "${prefix}"
|
||||||
DOWNLOAD_DIR "${CMAKE_SOURCE_DIR}/deps/downloads"
|
DOWNLOAD_DIR "${PROJECT_SOURCE_DIR}/deps/downloads"
|
||||||
DOWNLOAD_NAME range-v3-0.12.0.tar.gz
|
DOWNLOAD_NAME range-v3-0.12.0.tar.gz
|
||||||
URL https://github.com/ericniebler/range-v3/archive/0.12.0.tar.gz
|
URL https://github.com/ericniebler/range-v3/archive/0.12.0.tar.gz
|
||||||
URL_HASH SHA256=015adb2300a98edfceaf0725beec3337f542af4915cec4d0b89fa0886f4ba9cb
|
URL_HASH SHA256=015adb2300a98edfceaf0725beec3337f542af4915cec4d0b89fa0886f4ba9cb
|
||||||
|
@ -46,7 +46,7 @@ set(sources
|
|||||||
|
|
||||||
add_library(solutil ${sources})
|
add_library(solutil ${sources})
|
||||||
target_link_libraries(solutil PUBLIC jsoncpp Boost::boost Boost::filesystem Boost::system range-v3 fmt::fmt-header-only)
|
target_link_libraries(solutil PUBLIC jsoncpp Boost::boost Boost::filesystem Boost::system range-v3 fmt::fmt-header-only)
|
||||||
target_include_directories(solutil PUBLIC "${CMAKE_SOURCE_DIR}")
|
target_include_directories(solutil PUBLIC "${PROJECT_SOURCE_DIR}")
|
||||||
add_dependencies(solutil solidity_BuildInfo.h)
|
add_dependencies(solutil solidity_BuildInfo.h)
|
||||||
|
|
||||||
if(SOLC_LINK_STATIC)
|
if(SOLC_LINK_STATIC)
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
# This will re-generate the headers if any file within src was modified.
|
# This will re-generate the headers if any file within src was modified.
|
||||||
set_directory_properties(PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/stdlib/src/)
|
set_directory_properties(PROPERTY CMAKE_CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/stdlib/src/)
|
||||||
|
|
||||||
set(STDLIB stub)
|
set(STDLIB stub)
|
||||||
set(GENERATED_STDLIB_HEADERS)
|
set(GENERATED_STDLIB_HEADERS)
|
||||||
foreach(src IN LISTS STDLIB)
|
foreach(src IN LISTS STDLIB)
|
||||||
set(STDLIB_FILE ${CMAKE_SOURCE_DIR}/libstdlib/src/${src}.sol)
|
set(STDLIB_FILE ${PROJECT_SOURCE_DIR}/libstdlib/src/${src}.sol)
|
||||||
file(READ ${STDLIB_FILE} STDLIB_FILE_CONTENT HEX)
|
file(READ ${STDLIB_FILE} STDLIB_FILE_CONTENT HEX)
|
||||||
string(REGEX MATCHALL ".." STDLIB_FILE_CONTENT "${STDLIB_FILE_CONTENT}")
|
string(REGEX MATCHALL ".." STDLIB_FILE_CONTENT "${STDLIB_FILE_CONTENT}")
|
||||||
list(REMOVE_ITEM STDLIB_FILE_CONTENT "0d")
|
list(REMOVE_ITEM STDLIB_FILE_CONTENT "0d")
|
||||||
string(REGEX REPLACE ";" ",\n\t0x" STDLIB_FILE_CONTENT "${STDLIB_FILE_CONTENT}")
|
string(REGEX REPLACE ";" ",\n\t0x" STDLIB_FILE_CONTENT "${STDLIB_FILE_CONTENT}")
|
||||||
set(STDLIB_FILE_CONTENT "0x${STDLIB_FILE_CONTENT}")
|
set(STDLIB_FILE_CONTENT "0x${STDLIB_FILE_CONTENT}")
|
||||||
set(STDLIB_FILE_NAME ${src})
|
set(STDLIB_FILE_NAME ${src})
|
||||||
configure_file("${CMAKE_SOURCE_DIR}/libstdlib/stdlib.src.h.in" ${CMAKE_BINARY_DIR}/include/libstdlib/${src}.h NEWLINE_STYLE LF @ONLY)
|
configure_file("${PROJECT_SOURCE_DIR}/libstdlib/stdlib.src.h.in" ${PROJECT_BINARY_DIR}/include/libstdlib/${src}.h NEWLINE_STYLE LF @ONLY)
|
||||||
list(APPEND GENERATED_STDLIB_HEADERS ${CMAKE_BINARY_DIR}/include/libstdlib/${src}.h)
|
list(APPEND GENERATED_STDLIB_HEADERS ${PROJECT_BINARY_DIR}/include/libstdlib/${src}.h)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
configure_file("${CMAKE_SOURCE_DIR}/libstdlib/stdlib.h.in" ${CMAKE_BINARY_DIR}/include/libstdlib/stdlib.h NEWLINE_STYLE LF @ONLY)
|
configure_file("${PROJECT_SOURCE_DIR}/libstdlib/stdlib.h.in" ${PROJECT_BINARY_DIR}/include/libstdlib/stdlib.h NEWLINE_STYLE LF @ONLY)
|
||||||
|
Loading…
Reference in New Issue
Block a user