From 8c5ecd1c0114aeb5e0ac24dc58218220d858237b Mon Sep 17 00:00:00 2001 From: Jun Zhang Date: Sat, 10 Jun 2023 00:21:55 +0800 Subject: [PATCH] Fix incorrectly CMAKE_BINARY_DIR usage Similiar to CMAKE_SOURCE_DIR. Using CMAKE_BINARY_DIR will put the generated header (stdlib.h) in build/include/solidity/libstdlib but it should start with build/third-party/solidity or the library can't find the header. Signed-off-by: Jun Zhang --- cmake/fmtlib.cmake | 2 +- cmake/jsoncpp.cmake | 2 +- cmake/range-v3.cmake | 2 +- libstdlib/CMakeLists.txt | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmake/fmtlib.cmake b/cmake/fmtlib.cmake index 2610424f6..792bf3b02 100644 --- a/cmake/fmtlib.cmake +++ b/cmake/fmtlib.cmake @@ -2,7 +2,7 @@ include(FetchContent) FetchContent_Declare( fmtlib - PREFIX "${CMAKE_BINARY_DIR}/deps" + PREFIX "${PROJECT_BINARY_DIR}/deps" DOWNLOAD_DIR "${PROJECT_SOURCE_DIR}/deps/downloads" DOWNLOAD_NAME fmt-8.0.1.tar.gz URL https://github.com/fmtlib/fmt/archive/8.0.1.tar.gz diff --git a/cmake/jsoncpp.cmake b/cmake/jsoncpp.cmake index 48a9d2b49..cf1cc656b 100644 --- a/cmake/jsoncpp.cmake +++ b/cmake/jsoncpp.cmake @@ -6,7 +6,7 @@ else() set(JSONCPP_CMAKE_COMMAND ${CMAKE_COMMAND}) 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_INCLUDE_DIR "${prefix}/include") diff --git a/cmake/range-v3.cmake b/cmake/range-v3.cmake index 4f3225420..d2f54452b 100644 --- a/cmake/range-v3.cmake +++ b/cmake/range-v3.cmake @@ -6,7 +6,7 @@ else() set(RANGE_V3_CMAKE_COMMAND ${CMAKE_COMMAND}) endif() -set(prefix "${CMAKE_BINARY_DIR}/deps") +set(prefix "${PROJECT_BINARY_DIR}/deps") set(RANGE_V3_INCLUDE_DIR "${prefix}/include") ExternalProject_Add(range-v3-project diff --git a/libstdlib/CMakeLists.txt b/libstdlib/CMakeLists.txt index 4a995c78f..65a3a1cda 100644 --- a/libstdlib/CMakeLists.txt +++ b/libstdlib/CMakeLists.txt @@ -11,8 +11,8 @@ foreach(src IN LISTS STDLIB) string(REGEX REPLACE ";" ",\n\t0x" STDLIB_FILE_CONTENT "${STDLIB_FILE_CONTENT}") set(STDLIB_FILE_CONTENT "0x${STDLIB_FILE_CONTENT}") set(STDLIB_FILE_NAME ${src}) - configure_file("${PROJECT_SOURCE_DIR}/libstdlib/stdlib.src.h.in" ${CMAKE_BINARY_DIR}/include/libstdlib/${src}.h NEWLINE_STYLE LF @ONLY) - list(APPEND GENERATED_STDLIB_HEADERS ${CMAKE_BINARY_DIR}/include/libstdlib/${src}.h) + 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 ${PROJECT_BINARY_DIR}/include/libstdlib/${src}.h) endforeach() -configure_file("${PROJECT_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)