Browse Source

Adjust the new all libraries function

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

30
functions.cmake

@ -32,50 +32,50 @@ function (create_test target)
endfunction (create_test)
function (create_static_library name output_name src doinstall)
function (create_shared_library name output_name src doinstall)
add_library("${name}" STATIC "${src}")
add_library("${name}" SHARED "${src}")
target_link_libraries("${name}" "${ARGN}")
set_target_properties("${name}" PROPERTIES OUTPUT_NAME "${output_name}")
if (doinstall)
install(TARGETS "${name}" ARCHIVE DESTINATION lib/)
install(TARGETS "${name}" LIBRARY DESTINATION lib/)
endif(doinstall)
endfunction (create_static_library)
endfunction (create_shared_library)
function (create_pic_library name output_name src doinstall)
function (create_static_library name output_name src doinstall)
add_library("${name}" STATIC "${src}")
target_link_libraries("${name}" "${ARGN}")
set_target_properties("${name}" PROPERTIES OUTPUT_NAME "${output_name}")
set_property(TARGET "${name}" PROPERTY POSITION_INDEPENDENT_CODE ON)
if (doinstall)
install(TARGETS "${name}" ARCHIVE DESTINATION lib/)
endif(doinstall)
endfunction (create_pic_library)
endfunction (create_static_library)
function (create_shared_library name output_name src doinstall)
function (create_pic_library name output_name src doinstall)
add_library("${name}" SHARED "${src}")
add_library("${name}" STATIC "${src}")
target_link_libraries("${name}" "${ARGN}")
set_target_properties("${name}" PROPERTIES OUTPUT_NAME "${output_name}")
set_property(TARGET "${name}" PROPERTY POSITION_INDEPENDENT_CODE ON)
if (doinstall)
install(TARGETS "${name}" LIBRARY DESTINATION lib/)
install(TARGETS "${name}" ARCHIVE DESTINATION lib/)
endif(doinstall)
endfunction (create_shared_library)
endfunction (create_pic_library)
function (create_all_libraries name src doinstall)
function (create_all_libraries shared_name static_name pic_name output_name src doinstall)
create_static_library("${name}" "${name}" "${src}" "${doinstall}" "${ARGN}")
create_pic_library("${name}" "${name}_pic" "${src}" "${doinstall}" "${ARGN}")
create_shared_library("${name}" "${name}" "${src}" "${doinstall}" "${ARGN}")
create_shared_library("${shared_name}" "${output_name}" "${src}" "${doinstall}" "${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