mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
8c5ecd1c01
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 <jun@junz.org>
19 lines
1.0 KiB
CMake
19 lines
1.0 KiB
CMake
# This will re-generate the headers if any file within src was modified.
|
|
set_directory_properties(PROPERTY CMAKE_CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/stdlib/src/)
|
|
|
|
set(STDLIB stub)
|
|
set(GENERATED_STDLIB_HEADERS)
|
|
foreach(src IN LISTS STDLIB)
|
|
set(STDLIB_FILE ${PROJECT_SOURCE_DIR}/libstdlib/src/${src}.sol)
|
|
file(READ ${STDLIB_FILE} STDLIB_FILE_CONTENT HEX)
|
|
string(REGEX MATCHALL ".." STDLIB_FILE_CONTENT "${STDLIB_FILE_CONTENT}")
|
|
list(REMOVE_ITEM STDLIB_FILE_CONTENT "0d")
|
|
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" ${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" ${PROJECT_BINARY_DIR}/include/libstdlib/stdlib.h NEWLINE_STYLE LF @ONLY)
|