Skip to content

Commit 0ad11aa

Browse files
committed
generalize cmake once more
1 parent a990d1a commit 0ad11aa

File tree

1 file changed

+33
-3
lines changed

1 file changed

+33
-3
lines changed

CMakeLists.txt

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,48 @@ set(${out_lib_name} "lib${component}.a" PARENT_SCOPE)
99
endif()
1010
endfunction()
1111

12+
function(select_lib output_lib lib_list configuration)
13+
list(LENGTH lib_list LIB_LEN )
14+
if(LIB_LEN GREATER 1)
15+
set(LIB_MET OFF)
16+
foreach(lib_i ${lib_list})
17+
if(LIB_MET)
18+
set(${output_lib} ${lib_i} PARENT_SCOPE)
19+
return()
20+
endif()
21+
if(NOT lib_i MATCHES ".*[Bb]oost.*" )
22+
if(lib_i STREQUAL "debug" )
23+
if(configuration STREQUAL "Debug")
24+
set(${LIB_MET} ON)
25+
endif()
26+
else()
27+
if(configuration STREQUAL "Release")
28+
set(${LIB_MET} ON)
29+
endif()
30+
endif()
31+
endif()
32+
endforeach(lib_i)
33+
else()
34+
set(${output_lib} ${lib_list} PARENT_SCOPE)
35+
endif()
36+
endfunction()
1237

1338
function(install_libs configuration lib_dir)
39+
40+
1441
get_lib_name(renamed_system "boost_system")
15-
install(FILES ${Boost_SYSTEM_LIBRARY}
42+
select_lib(src_lib_x ${Boost_SYSTEM_LIBRARY} ${configuration} )
43+
install(FILES ${src_lib_x}
1644
CONFIGURATIONS ${configuration} DESTINATION ${lib_dir} RENAME ${renamed_system}
1745
)
1846
get_lib_name(renamed_date_time "boost_date_time")
19-
install(FILES ${Boost_DATE_TIME_LIBRARY}
47+
select_lib(src_lib_y ${Boost_SYSTEM_LIBRARY} ${configuration} )
48+
install(FILES ${src_lib_y}
2049
CONFIGURATIONS ${configuration} DESTINATION ${lib_dir} RENAME ${renamed_date_time}
2150
)
2251
get_lib_name(renamed_random "boost_random")
23-
install(FILES ${Boost_RANDOM_LIBRARY}
52+
select_lib(src_lib_z ${Boost_SYSTEM_LIBRARY} ${configuration} )
53+
install(FILES ${src_lib_z}
2454
CONFIGURATIONS ${configuration} DESTINATION ${lib_dir} RENAME ${renamed_random}
2555
)
2656

0 commit comments

Comments
 (0)