aboutsummaryrefslogtreecommitdiff
path: root/cmake/modules/AddLLVM.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'cmake/modules/AddLLVM.cmake')
-rwxr-xr-xcmake/modules/AddLLVM.cmake34
1 files changed, 25 insertions, 9 deletions
diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake
index 0ecd153c6be4..dfe67cded331 100755
--- a/cmake/modules/AddLLVM.cmake
+++ b/cmake/modules/AddLLVM.cmake
@@ -4,11 +4,17 @@ include(LLVMConfig)
macro(add_llvm_library name)
llvm_process_sources( ALL_FILES ${ARGN} )
add_library( ${name} ${ALL_FILES} )
- set( llvm_libs ${llvm_libs} ${name} PARENT_SCOPE)
- set( llvm_lib_targets ${llvm_lib_targets} ${name} PARENT_SCOPE )
+ set_property( GLOBAL APPEND PROPERTY LLVM_LIBS ${name} )
+ set_property( GLOBAL APPEND PROPERTY LLVM_LIB_TARGETS ${name} )
if( LLVM_COMMON_DEPENDS )
add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
endif( LLVM_COMMON_DEPENDS )
+
+ if( BUILD_SHARED_LIBS )
+ get_system_libs(sl)
+ target_link_libraries( ${name} ${sl} )
+ endif()
+
install(TARGETS ${name}
LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
@@ -23,12 +29,20 @@ endmacro(add_llvm_library name)
macro(add_llvm_loadable_module name)
- if( NOT LLVM_ON_UNIX )
+ if( NOT LLVM_ON_UNIX OR CYGWIN )
message(STATUS "Loadable modules not supported on this platform.
${name} ignored.")
+ # Add empty "phony" target
+ add_custom_target(${name})
else()
llvm_process_sources( ALL_FILES ${ARGN} )
- add_library( ${name} MODULE ${ALL_FILES} )
+ if (MODULE)
+ set(libkind MODULE)
+ else()
+ set(libkind SHARED)
+ endif()
+
+ add_library( ${name} ${libkind} ${ALL_FILES} )
set_target_properties( ${name} PROPERTIES PREFIX "" )
if (APPLE)
@@ -60,13 +74,15 @@ macro(add_llvm_executable name)
if( LLVM_LINK_COMPONENTS )
llvm_config(${name} ${LLVM_LINK_COMPONENTS})
endif( LLVM_LINK_COMPONENTS )
- get_system_libs(llvm_system_libs)
- if( llvm_system_libs )
- target_link_libraries(${name} ${llvm_system_libs})
- endif()
if( LLVM_COMMON_DEPENDS )
add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
endif( LLVM_COMMON_DEPENDS )
+ if( NOT MINGW )
+ get_system_libs(llvm_system_libs)
+ if( llvm_system_libs )
+ target_link_libraries(${name} ${llvm_system_libs})
+ endif()
+ endif()
endmacro(add_llvm_executable name)
@@ -105,5 +121,5 @@ macro(add_llvm_target target_name)
if ( TABLEGEN_OUTPUT )
add_dependencies(LLVM${target_name} ${target_name}Table_gen)
endif (TABLEGEN_OUTPUT)
- set(CURRENT_LLVM_TARGET LLVM${target_name} PARENT_SCOPE)
+ set( CURRENT_LLVM_TARGET LLVM${target_name} )
endmacro(add_llvm_target)