moved source finding logic to its own function for easy reuse later
This commit is contained in:
parent
f32328c32a
commit
405ba80d8d
@ -51,17 +51,23 @@ endforeach(cogfile)
|
|||||||
|
|
||||||
add_custom_target(cog ALL DEPENDS ${coggedfiles})
|
add_custom_target(cog ALL DEPENDS ${coggedfiles})
|
||||||
|
|
||||||
set(cellar_LIBRARIES)
|
function(get_sources globtarget output)
|
||||||
function(cellar_library target)
|
|
||||||
file(GLOB_RECURSE targetsources RELATIVE "${CMAKE_SOURCE_DIR}"
|
file(GLOB_RECURSE targetsources RELATIVE "${CMAKE_SOURCE_DIR}"
|
||||||
"${CMAKE_SOURCE_DIR}/src/${target}/*.cpp")
|
"${CMAKE_SOURCE_DIR}/${globtarget}")
|
||||||
file(GLOB_RECURSE targetcoggedsources RELATIVE "${CMAKE_SOURCE_DIR}"
|
file(GLOB_RECURSE targetcoggedsources RELATIVE "${CMAKE_SOURCE_DIR}"
|
||||||
"${CMAKE_SOURCE_DIR}/src/${target}/*.cpp.cog")
|
"${CMAKE_SOURCE_DIR}/${globtarget}.cog")
|
||||||
foreach(targetcog ${targetcoggedsources})
|
foreach(targetcog ${targetcoggedsources})
|
||||||
string(REGEX REPLACE ".cog\$" "" this "${targetcog}")
|
string(REGEX REPLACE ".cog\$" "" this "${targetcog}")
|
||||||
set(targetsources ${targetsources} ${this})
|
set(targetsources ${targetsources} ${this})
|
||||||
endforeach(targetcog)
|
endforeach(targetcog)
|
||||||
|
|
||||||
|
set(${output} ${targetsources} PARENT_SCOPE)
|
||||||
|
endfunction(get_sources)
|
||||||
|
|
||||||
|
set(cellar_LIBRARIES)
|
||||||
|
function(cellar_library target)
|
||||||
|
get_sources("src/${target}/*.cpp" targetsources)
|
||||||
|
|
||||||
add_library(${target} SHARED ${targetsources})
|
add_library(${target} SHARED ${targetsources})
|
||||||
add_dependencies(${target} cog)
|
add_dependencies(${target} cog)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user