initial commit
This commit is contained in:
30
cmake/Templates.cmake
Normal file
30
cmake/Templates.cmake
Normal file
@@ -0,0 +1,30 @@
|
||||
macro(add_bluelib_module module_name)
|
||||
file(GLOB sources *.c *.h)
|
||||
file(GLOB sys_sources sys/${b_system_name}/*.c sys/${b_system_name}/*.h)
|
||||
set(root_header include/blue/${module_name}.h)
|
||||
file(GLOB headers include/blue/${module_name}/*.h)
|
||||
|
||||
add_library(blue-${module_name}-obj OBJECT ${sources} ${root_header} ${headers})
|
||||
|
||||
set_target_properties(blue-${module_name}-obj
|
||||
PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
string(REPLACE "-" "_" module_preproc_token ${module_name})
|
||||
string(TOUPPER ${module_preproc_token} module_preproc_token)
|
||||
set(module_preproc_token BLUELIB_${module_preproc_token})
|
||||
|
||||
target_include_directories(blue-${module_name}-obj PUBLIC include/)
|
||||
target_compile_definitions(blue-${module_name}-obj PUBLIC ${module_preproc_token})
|
||||
|
||||
message(STATUS "Building module ${module_name} (shared)")
|
||||
add_library(blue-${module_name} SHARED $<TARGET_OBJECTS:blue-${module_name}-obj>)
|
||||
message(STATUS "Building module ${module_name} (static)")
|
||||
add_library(blue-${module_name}-s STATIC $<TARGET_OBJECTS:blue-${module_name}-obj>)
|
||||
|
||||
target_include_directories(blue-${module_name} PUBLIC include/)
|
||||
target_include_directories(blue-${module_name}-s PUBLIC include/)
|
||||
|
||||
install(TARGETS blue-${module_name} blue-${module_name}-s)
|
||||
install(FILES ${root_header} DESTINATION include/blue)
|
||||
install(FILES ${headers} DESTINATION include/blue/${module_name})
|
||||
endmacro(add_bluelib_module)
|
||||
Reference in New Issue
Block a user