[lib] add missing file

This commit is contained in:
tangxifan 2023-06-21 23:02:43 -07:00
parent b8d89d2a5c
commit a628a1e7b0
1 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,37 @@
cmake_minimum_required(VERSION 3.9)
project("libionamemap")
file(GLOB_RECURSE EXEC_SOURCES test/*.cpp)
file(GLOB_RECURSE LIB_SOURCES src/*/*.cpp)
file(GLOB_RECURSE LIB_HEADERS src/*/*.h)
files_to_dirs(LIB_HEADERS LIB_INCLUDE_DIRS)
#Remove test executable from library
list(REMOVE_ITEM LIB_SOURCES ${EXEC_SOURCES})
#Create the library
add_library(libionamemap STATIC
${LIB_HEADERS}
${LIB_SOURCES})
target_include_directories(libionamemap PUBLIC ${LIB_INCLUDE_DIRS})
set_target_properties(libionamemap PROPERTIES PREFIX "") #Avoid extra 'lib' prefix
#Specify link-time dependancies
target_link_libraries(libionamemap
libarchopenfpga
libopenfpgautil
libopenfpgashell
libvtrutil
libpugiutil)
#Create the test executable
foreach(testsourcefile ${EXEC_SOURCES})
# Use a simple string replace, to cut off .cpp.
get_filename_component(testname ${testsourcefile} NAME_WE)
add_executable(${testname} ${testsourcefile})
# Make sure the library is linked to each test executable
target_link_libraries(${testname} libionamemap)
endforeach(testsourcefile ${EXEC_SOURCES})
install(TARGETS libionamemap DESTINATION bin)