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
|
add_custom_target(ban-install
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/libban.a ${BANAN_LIB}/
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/libban.a ${BANAN_LIB}/
|
||||||
DEPENDS ban
|
DEPENDS ban
|
||||||
|
BYPRODUCTS ${BANAN_LIB}/libban.a
|
||||||
)
|
)
|
||||||
|
|
|
@ -26,6 +26,7 @@ add_dependencies(libc headers crt0)
|
||||||
add_custom_target(libc-install
|
add_custom_target(libc-install
|
||||||
COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/libc.a ${BANAN_LIB}/
|
COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/libc.a ${BANAN_LIB}/
|
||||||
DEPENDS libc
|
DEPENDS libc
|
||||||
|
BYPRODUCTS ${BANAN_LIB}/libc.a
|
||||||
)
|
)
|
||||||
|
|
||||||
set(CMAKE_STATIC_LIBRARY_PREFIX "")
|
set(CMAKE_STATIC_LIBRARY_PREFIX "")
|
||||||
|
|
|
@ -17,6 +17,7 @@ add_custom_target(userspace)
|
||||||
add_custom_target(userspace-install DEPENDS userspace)
|
add_custom_target(userspace-install DEPENDS userspace)
|
||||||
|
|
||||||
foreach(USERSPACE_PROJECT ${USERSPACE_PROJECTS})
|
foreach(USERSPACE_PROJECT ${USERSPACE_PROJECTS})
|
||||||
|
target_link_options(${USERSPACE_PROJECT} PUBLIC -nodefaultlibs)
|
||||||
add_dependencies(userspace ${USERSPACE_PROJECT})
|
add_dependencies(userspace ${USERSPACE_PROJECT})
|
||||||
add_dependencies(userspace-install ${USERSPACE_PROJECT}-install)
|
add_dependencies(userspace-install ${USERSPACE_PROJECT}-install)
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
|
@ -8,10 +8,7 @@ set(SOURCES
|
||||||
|
|
||||||
add_executable(Shell ${SOURCES})
|
add_executable(Shell ${SOURCES})
|
||||||
target_compile_options(Shell PUBLIC -O2 -g)
|
target_compile_options(Shell PUBLIC -O2 -g)
|
||||||
add_dependencies(Shell libc-install ban-install)
|
target_link_libraries(Shell PUBLIC libc ban)
|
||||||
target_link_options(Shell PUBLIC -nodefaultlibs)
|
|
||||||
target_link_libraries(Shell PUBLIC ${BANAN_LIB}/libc.a)
|
|
||||||
target_link_libraries(Shell PUBLIC ${BANAN_LIB}/libban.a)
|
|
||||||
|
|
||||||
add_custom_target(Shell-install
|
add_custom_target(Shell-install
|
||||||
COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/Shell ${BANAN_BIN}/
|
COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/Shell ${BANAN_BIN}/
|
||||||
|
|
|
@ -8,8 +8,7 @@ set(SOURCES
|
||||||
|
|
||||||
add_executable(cat ${SOURCES})
|
add_executable(cat ${SOURCES})
|
||||||
target_compile_options(cat PUBLIC -O2 -g)
|
target_compile_options(cat PUBLIC -O2 -g)
|
||||||
add_dependencies(cat libc-install)
|
target_link_libraries(cat PUBLIC libc)
|
||||||
target_link_options(cat PUBLIC -nodefaultlibs -lc)
|
|
||||||
|
|
||||||
add_custom_target(cat-install
|
add_custom_target(cat-install
|
||||||
COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/cat ${BANAN_BIN}/
|
COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/cat ${BANAN_BIN}/
|
||||||
|
|
|
@ -8,9 +8,7 @@ set(TEST_SOURCES
|
||||||
|
|
||||||
add_executable(test ${TEST_SOURCES})
|
add_executable(test ${TEST_SOURCES})
|
||||||
target_compile_options(test PUBLIC -O2 -g)
|
target_compile_options(test PUBLIC -O2 -g)
|
||||||
add_dependencies(test libc-install)
|
target_link_libraries(test PUBLIC libc)
|
||||||
target_link_options(test PUBLIC -nodefaultlibs)
|
|
||||||
target_link_libraries(test PUBLIC ${BANAN_LIB}/libc.a)
|
|
||||||
|
|
||||||
add_custom_target(test-install
|
add_custom_target(test-install
|
||||||
COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/test ${BANAN_BIN}/
|
COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/test ${BANAN_BIN}/
|
||||||
|
|
|
@ -8,8 +8,7 @@ set(SOURCES
|
||||||
|
|
||||||
add_executable(yes ${SOURCES})
|
add_executable(yes ${SOURCES})
|
||||||
target_compile_options(yes PUBLIC -O2 -g)
|
target_compile_options(yes PUBLIC -O2 -g)
|
||||||
add_dependencies(yes libc-install)
|
target_link_libraries(yes PUBLIC libc)
|
||||||
target_link_options(yes PUBLIC -nodefaultlibs -lc)
|
|
||||||
|
|
||||||
add_custom_target(yes-install
|
add_custom_target(yes-install
|
||||||
COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/yes ${BANAN_BIN}/
|
COMMAND cp ${CMAKE_CURRENT_BINARY_DIR}/yes ${BANAN_BIN}/
|
||||||
|
|
Loading…
Reference in New Issue