-
Notifications
You must be signed in to change notification settings - Fork 9
/
PropWareSources.cmake
36 lines (35 loc) · 1.38 KB
/
PropWareSources.cmake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
function(create_pw_lib)
set(options C_ONLY)
set(oneValueArgs LIB_NAME MODEL)
set(multiValueArgs EXTRA_INCLUDE_DIRS SOURCES)
cmake_parse_arguments(ARGS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set(TARGET ${ARGS_LIB_NAME}_${ARGS_MODEL})
list(LENGTH ARGS_SOURCES SRC_COUNT)
if (SRC_COUNT)
add_library(${TARGET} ${ARGS_SOURCES})
endif ()
set_compile_flags(${TARGET} ${ARGS_MODEL})
if (NOT LIB_NAME STREQUAL "PropWare")
target_compile_options(${TARGET} PRIVATE -w)
endif ()
if (ARGS_C_ONLY)
set(SYSTEM_ARG SYSTEM)
target_include_directories(${TARGET} SYSTEM PUBLIC $<INSTALL_INTERFACE:share/PropWare/include>)
else ()
target_include_directories(${TARGET} PUBLIC $<INSTALL_INTERFACE:share/PropWare/include/c++>)
endif ()
foreach(d IN LISTS ARGS_EXTRA_INCLUDE_DIRS)
list(APPEND BUILD_INTERFACE_DIRS $<BUILD_INTERFACE:${d}>)
endforeach()
target_include_directories(${TARGET} ${SYSTEM_ARG} PUBLIC ${BUILD_INTERFACE_DIRS})
set_linker(${TARGET})
set_target_properties(${TARGET} PROPERTIES OUTPUT_NAME ${ARGS_LIB_NAME})
install(TARGETS ${TARGET}
DESTINATION share/PropWare/lib/${ARGS_MODEL}
COMPONENT propware
EXPORT PropWare-targets)
endfunction()
add_subdirectory(external_libs)
add_subdirectory(PropWare)
add_subdirectory(Examples)
add_subdirectory(test)