diff options
Diffstat (limited to 'cmake/Modules/AddCompilerRT.cmake')
-rw-r--r-- | cmake/Modules/AddCompilerRT.cmake | 52 |
1 files changed, 17 insertions, 35 deletions
diff --git a/cmake/Modules/AddCompilerRT.cmake b/cmake/Modules/AddCompilerRT.cmake index 8b6518d13..bed0826ff 100644 --- a/cmake/Modules/AddCompilerRT.cmake +++ b/cmake/Modules/AddCompilerRT.cmake @@ -132,7 +132,7 @@ endmacro() # Adds static or shared runtime for a list of architectures and operating # systems and puts it in the proper directory in the build and install trees. # add_compiler_rt_runtime(<name> -# {OBJECT|STATIC|SHARED} +# {STATIC|SHARED} # ARCHS <architectures> # OS <os list> # SOURCES <source files> @@ -144,8 +144,8 @@ endmacro() # PARENT_TARGET <convenience parent target> # ADDITIONAL_HEADERS <header files>) function(add_compiler_rt_runtime name type) - if(NOT type MATCHES "^(OBJECT|STATIC|SHARED)$") - message(FATAL_ERROR "type argument must be OBJECT, STATIC or SHARED") + if(NOT type MATCHES "^(STATIC|SHARED)$") + message(FATAL_ERROR "type argument must be STATIC or SHARED") return() endif() cmake_parse_arguments(LIB @@ -204,10 +204,7 @@ function(add_compiler_rt_runtime name type) message(FATAL_ERROR "Architecture ${arch} can't be targeted") return() endif() - if(type STREQUAL "OBJECT") - set(libname "${name}-${arch}") - set_output_name(output_name_${libname} ${name}${COMPILER_RT_OS_SUFFIX} ${arch}) - elseif(type STREQUAL "STATIC") + if(type STREQUAL "STATIC") set(libname "${name}-${arch}") set_output_name(output_name_${libname} ${name} ${arch}) else() @@ -273,34 +270,12 @@ function(add_compiler_rt_runtime name type) set(COMPONENT_OPTION COMPONENT ${libname}) endif() - if(type STREQUAL "OBJECT") - string(TOUPPER ${CMAKE_BUILD_TYPE} config) - get_property(cflags SOURCE ${sources_${libname}} PROPERTY COMPILE_FLAGS) - separate_arguments(cflags) - add_custom_command( - OUTPUT ${output_dir_${libname}}/${output_name_${libname}}.o - COMMAND ${CMAKE_C_COMPILER} ${sources_${libname}} ${cflags} ${extra_cflags_${libname}} -c -o ${output_dir_${libname}}/${output_name_${libname}}.o - DEPENDS ${sources_${libname}} - COMMENT "Building C object ${output_name_${libname}}.o") - add_custom_target(${libname} DEPENDS ${output_dir_${libname}}/${output_name_${libname}}.o) - install(FILES ${output_dir_${libname}}/${output_name_${libname}}.o - DESTINATION ${install_dir_${libname}} - ${COMPONENT_OPTION}) - else() - add_library(${libname} ${type} ${sources_${libname}}) - set_target_compile_flags(${libname} ${extra_cflags_${libname}}) - set_target_link_flags(${libname} ${extra_link_flags_${libname}}) - set_property(TARGET ${libname} APPEND PROPERTY - COMPILE_DEFINITIONS ${LIB_DEFS}) - set_target_output_directories(${libname} ${output_dir_${libname}}) - install(TARGETS ${libname} - ARCHIVE DESTINATION ${install_dir_${libname}} - ${COMPONENT_OPTION} - LIBRARY DESTINATION ${install_dir_${libname}} - ${COMPONENT_OPTION} - RUNTIME DESTINATION ${install_dir_${libname}} - ${COMPONENT_OPTION}) - endif() + add_library(${libname} ${type} ${sources_${libname}}) + set_target_compile_flags(${libname} ${extra_cflags_${libname}}) + set_target_link_flags(${libname} ${extra_link_flags_${libname}}) + set_property(TARGET ${libname} APPEND PROPERTY + COMPILE_DEFINITIONS ${LIB_DEFS}) + set_target_output_directories(${libname} ${output_dir_${libname}}) set_target_properties(${libname} PROPERTIES OUTPUT_NAME ${output_name_${libname}}) set_target_properties(${libname} PROPERTIES FOLDER "Compiler-RT Runtime") @@ -324,6 +299,13 @@ function(add_compiler_rt_runtime name type) ) endif() endif() + install(TARGETS ${libname} + ARCHIVE DESTINATION ${install_dir_${libname}} + ${COMPONENT_OPTION} + LIBRARY DESTINATION ${install_dir_${libname}} + ${COMPONENT_OPTION} + RUNTIME DESTINATION ${install_dir_${libname}} + ${COMPONENT_OPTION}) # We only want to generate per-library install targets if you aren't using # an IDE because the extra targets get cluttered in IDEs. |