BuildSystem: link libraries when they change
This also fixed the need for manual linkin on firt build
This commit is contained in:
parent
a75a3f7a5f
commit
a378e59432
|
@ -20,4 +20,5 @@ add_dependencies(ban headers libc-install)
|
|||
add_custom_target(ban-install
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/libban.a ${BANAN_LIB}/
|
||||
DEPENDS ban
|
||||
BYPRODUCTS ${BANAN_LIB}/libban.a
|
||||
)
|
||||
|
|
|
@ -26,6 +26,7 @@ add_dependencies(libc headers crt0)
|
|||
add_custom_target(libc-install
|
||||
COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/libc.a ${BANAN_LIB}/
|
||||
DEPENDS libc
|
||||
BYPRODUCTS ${BANAN_LIB}/libc.a
|
||||
)
|
||||
|
||||
set(CMAKE_STATIC_LIBRARY_PREFIX "")
|
||||
|
|
|
@ -17,6 +17,7 @@ add_custom_target(userspace)
|
|||
add_custom_target(userspace-install DEPENDS userspace)
|
||||
|
||||
foreach(USERSPACE_PROJECT ${USERSPACE_PROJECTS})
|
||||
target_link_options(${USERSPACE_PROJECT} PUBLIC -nodefaultlibs)
|
||||
add_dependencies(userspace ${USERSPACE_PROJECT})
|
||||
add_dependencies(userspace-install ${USERSPACE_PROJECT}-install)
|
||||
endforeach()
|
||||
|
|
|
@ -8,10 +8,7 @@ set(SOURCES
|
|||
|
||||
add_executable(Shell ${SOURCES})
|
||||
target_compile_options(Shell PUBLIC -O2 -g)
|
||||
add_dependencies(Shell libc-install ban-install)
|
||||
target_link_options(Shell PUBLIC -nodefaultlibs)
|
||||
target_link_libraries(Shell PUBLIC ${BANAN_LIB}/libc.a)
|
||||
target_link_libraries(Shell PUBLIC ${BANAN_LIB}/libban.a)
|
||||
target_link_libraries(Shell PUBLIC libc ban)
|
||||
|
||||
add_custom_target(Shell-install
|
||||
COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/Shell ${BANAN_BIN}/
|
||||
|
|
|
@ -8,8 +8,7 @@ set(SOURCES
|
|||
|
||||
add_executable(cat ${SOURCES})
|
||||
target_compile_options(cat PUBLIC -O2 -g)
|
||||
add_dependencies(cat libc-install)
|
||||
target_link_options(cat PUBLIC -nodefaultlibs -lc)
|
||||
target_link_libraries(cat PUBLIC libc)
|
||||
|
||||
add_custom_target(cat-install
|
||||
COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/cat ${BANAN_BIN}/
|
||||
|
|
|
@ -8,9 +8,7 @@ set(TEST_SOURCES
|
|||
|
||||
add_executable(test ${TEST_SOURCES})
|
||||
target_compile_options(test PUBLIC -O2 -g)
|
||||
add_dependencies(test libc-install)
|
||||
target_link_options(test PUBLIC -nodefaultlibs)
|
||||
target_link_libraries(test PUBLIC ${BANAN_LIB}/libc.a)
|
||||
target_link_libraries(test PUBLIC libc)
|
||||
|
||||
add_custom_target(test-install
|
||||
COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/test ${BANAN_BIN}/
|
||||
|
|
|
@ -8,8 +8,7 @@ set(SOURCES
|
|||
|
||||
add_executable(yes ${SOURCES})
|
||||
target_compile_options(yes PUBLIC -O2 -g)
|
||||
add_dependencies(yes libc-install)
|
||||
target_link_options(yes PUBLIC -nodefaultlibs -lc)
|
||||
target_link_libraries(yes PUBLIC libc)
|
||||
|
||||
add_custom_target(yes-install
|
||||
COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/yes ${BANAN_BIN}/
|
||||
|
|
Loading…
Reference in New Issue