Browse Source

Add a function to create a merge library

master
Gavin Howard 4 years ago
parent
commit
a2400fd444
Signed by: gavin GPG Key ID: C08038BDF280D33E
  1. 29
      functions.cmake

29
functions.cmake

@ -239,7 +239,7 @@ function(create_shared_library name output_name src doinstall)
endfunction(create_shared_library)
function(create_static_library name output_name src doinstall domerge)
function(create_static_library name output_name src doinstall)
add_library("${name}" STATIC "${src}")
target_link_libraries("${name}" "${ARGN}")
@ -248,17 +248,13 @@ function(create_static_library name output_name src doinstall domerge)
PROPERTIES
OUTPUT_NAME "${output_name}")
if(doinstall AND NOT domerge)
if(doinstall)
install(TARGETS "${name}" ARCHIVE DESTINATION lib/)
endif(doinstall AND NOT domerge)
if(domerge)
merge_lib("${name}" "${output_name}")
endif(domerge)
endif(doinstall)
endfunction(create_static_library)
function(create_pic_library name output_name src doinstall domerge)
function(create_pic_library name output_name src doinstall)
add_library("${name}" STATIC "${src}")
target_link_libraries("${name}" "${ARGN}")
@ -268,21 +264,22 @@ function(create_pic_library name output_name src doinstall domerge)
OUTPUT_NAME "${output_name}"
POSITION_INDEPENDENT_CODE ON)
if(doinstall AND NOT domerge)
if(doinstall)
install(TARGETS "${name}" ARCHIVE DESTINATION lib/)
endif(doinstall AND NOT domerge)
if(domerge)
merge_lib("${name}" "${output_name}")
endif(domerge)
endif(doinstall)
endfunction(create_pic_library)
function(create_merge_library name src)
create_pic_library("${name}" "${name}" "${src}" NO "${ARGN}")
merge_lib("${name}" "${name}")
endfunction(create_merge_library)
function(create_all_libraries shared_name static_name pic_name output_name src doinstall)
create_shared_library("${shared_name}" "${output_name}" "${src}" "${doinstall}" "${ARGN}")
create_static_library("${static_name}" "${output_name}" "${src}" "${doinstall}" NO "${ARGN}")
create_pic_library("${pic_name}" "${output_name}_pic" "${src}" "${doinstall}" NO "${ARGN}")
create_static_library("${static_name}" "${output_name}" "${src}" "${doinstall}" "${ARGN}")
create_pic_library("${pic_name}" "${output_name}_pic" "${src}" "${doinstall}" "${ARGN}")
endfunction(create_all_libraries)

Loading…
Cancel
Save