#cmake_minimum_required(VERSION 3.12) project(libwrap) message(STATUS " here 2 in libwrap") set(LIBRARY_NAME libwrap) set(STATIC_LIBRARY_FLAGS "rcs") # Create object library for libwrap set(LIB_SOURCES sys/_exit.c sys/close.c sys/execve.c sys/fork.c sys/fstat.c sys/getpid.c sys/isatty.c sys/kill.c sys/link.c sys/lseek.c sys/open.c sys/openat.c sys/printf.c sys/puts.c sys/read.c sys/sbrk.c sys/stat.c sys/times.c sys/unlink.c sys/wait.c # sys/write.c # Standard library stdlib/malloc.c # Miscellaneous misc/write_hex.c ) if(SEMIHOSTING) list(APPEND LIB_SOURCES semihosting/semihosting.c semihosting/trap.c ) endif() #add_library(${LIBRARY_NAME} OBJECT ${LIB_SOURCES}) add_library(${LIBRARY_NAME} STATIC ${LIB_SOURCES}) set_target_properties(${LIBRARY_NAME} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bare-metal-bsp/${PROJECT_NAME}) message(STATUS " CMAKE_BINARY_DIR: ${CMAKE_BINARY_DIR} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}") # Retrieve the output directory for the library get_target_property(LIBRARY_PATH ${LIBRARY_NAME} ARCHIVE_OUTPUT_DIRECTORY) # Print the path to the console (for debugging purposes) message(STATUS "The library output path is: ${LIBRARY_PATH}") # Include directories target_include_directories(${LIBRARY_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR} ${BSP_BASE}/include include/ ${BSP_BASE}/env ${BSP_BASE}/env/${BOARD} ${BSP_BASE}/drivers ) #link global_compile_options to this libraries #target_link_libraries(${PROJECT_NAME} PRIVATE global_compile_options) # Compile definitions #target_compile_definitions(libwrap_objects PRIVATE # BOARD_${BOARD} #) # Export objects to parent scope #set(LIBWRAP_OBJECTS $ PARENT_SCOPE)