diff --git a/stage0/src/CMakeLists.txt b/stage0/src/CMakeLists.txt index 7eac7c723a..b719e6f5d9 100644 --- a/stage0/src/CMakeLists.txt +++ b/stage0/src/CMakeLists.txt @@ -535,15 +535,21 @@ install(FILES ${CMAKE_BINARY_DIR}/lib/lean/libleancpp.a DESTINATION lib/lean) if(${STAGE} EQUAL 0) add_library(Init STATIC $) + add_library(Std STATIC $) else() # created by the previous stage add_library(Init STATIC IMPORTED) set_target_properties(Init PROPERTIES IMPORTED_LOCATION "${PREV_STAGE}/lib/lean/libInit.a") + + add_library(Std STATIC IMPORTED) + set_target_properties(Std PROPERTIES + IMPORTED_LOCATION "${PREV_STAGE}/lib/lean/libStd.a") endif() # leancpp and Init are cyclically dependent target_link_libraries(Init INTERFACE leancpp) -target_link_libraries(leancpp INTERFACE Init ${EXTRA_LIBS}) +target_link_libraries(Std INTERFACE leancpp) +target_link_libraries(leancpp INTERFACE Init Std ${EXTRA_LIBS}) if(LLVM) target_link_libraries(leancpp INTERFACE ${llvm_libs}) @@ -551,7 +557,7 @@ endif() add_custom_target(update-stage0 COMMAND cmake -E env LIB=${CMAKE_BINARY_DIR}/lib bash script/update-stage0 - DEPENDS Init + DEPENDS Init Std WORKING_DIRECTORY "${LIB_SOURCE_DIR}/..") configure_file("${LEAN_SOURCE_DIR}/bin/leanc.in" "${CMAKE_BINARY_DIR}/bin/leanc" @ONLY) diff --git a/stage0/src/bin/leanc.in b/stage0/src/bin/leanc.in index 5a19c6fd1d..bfd7cd81aa 100755 --- a/stage0/src/bin/leanc.in +++ b/stage0/src/bin/leanc.in @@ -18,7 +18,7 @@ cflags=("-I$bindir/../include") ldflags=("-L$bindir/../lib/lean" "-lgmp" @LEANC_EXTRA_FLAGS@) # static linker flags # NOTE: libleancpp and libInit are cyclically dependent -ldflags_ext=("-lleancpp" "-lInit" "-lleancpp" "-lInit") +ldflags_ext=("-lleancpp" "-lInit" "-lStd" "-lleancpp" "-lInit" "-lStd") for arg in "$@"; do # passed -shared ~> switch to shared linker flags [[ $arg == "-shared" ]] && ldflags_ext=(@LEANC_SHARED_LINKER_FLAGS@) diff --git a/stage0/src/shell/CMakeLists.txt b/stage0/src/shell/CMakeLists.txt index f2e2084fa5..8327bd01ba 100644 --- a/stage0/src/shell/CMakeLists.txt +++ b/stage0/src/shell/CMakeLists.txt @@ -1,6 +1,6 @@ add_executable(lean lean.cpp) set_target_properties(lean PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin") -target_link_libraries(lean leancpp Init) +target_link_libraries(lean leancpp Init Std) # create import library on Windows to link plugins against set_target_properties(lean PROPERTIES ENABLE_EXPORTS ON)