From b1adf0890a1c19b2fd32a525c7c99e9db6da493f Mon Sep 17 00:00:00 2001 From: Alp Toker Date: Wed, 8 Jan 2014 11:10:24 +0000 Subject: CMake: Provide LLVM_PLUGIN_EXT definition This is needed to support the addition of tests for clang loadable plugins. In clang, plugins are built as modules (bundles on OS X) rather than dynamic libraries (dylib) so the build system needs to inform lit of the actual file extension in use, typically '.so' on Unix and '.dll' on Windows. (LLVM itself should probably switch to this scheme to fix PR14903 once and for all.) No change in build output or functionality intended. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@198746 91177308-0d34-0410-b5e6-96231b3b80d8 --- cmake/modules/AddLLVM.cmake | 4 ++++ cmake/modules/HandleLLVMOptions.cmake | 9 ++++----- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/cmake/modules/AddLLVM.cmake b/cmake/modules/AddLLVM.cmake index 83422fb18f..de00ab46ae 100644 --- a/cmake/modules/AddLLVM.cmake +++ b/cmake/modules/AddLLVM.cmake @@ -215,6 +215,10 @@ ${name} ignored.") LINK_FLAGS " -Wl,-flat_namespace -Wl,-undefined -Wl,suppress") endif() + if (MODULE) + set_property(TARGET ${name} PROPERTY SUFFIX ${LLVM_PLUGIN_EXT}) + endif () + if( EXCLUDE_FROM_ALL ) set_target_properties( ${name} PROPERTIES EXCLUDE_FROM_ALL ON) else() diff --git a/cmake/modules/HandleLLVMOptions.cmake b/cmake/modules/HandleLLVMOptions.cmake index 21d2cd6740..f19d10dd16 100644 --- a/cmake/modules/HandleLLVMOptions.cmake +++ b/cmake/modules/HandleLLVMOptions.cmake @@ -49,8 +49,6 @@ if(WIN32) set(LLVM_ON_WIN32 1) set(LLVM_ON_UNIX 0) endif(CYGWIN) - set(LTDL_SHLIB_EXT ".dll") - set(EXEEXT ".exe") # Maximum path length is 160 for non-unicode paths set(MAXPATHLEN 160) else(WIN32) @@ -59,12 +57,9 @@ else(WIN32) set(LLVM_ON_UNIX 1) if(APPLE) set(LLVM_HAVE_LINK_VERSION_SCRIPT 0) - set(LTDL_SHLIB_EXT ".dylib") else(APPLE) set(LLVM_HAVE_LINK_VERSION_SCRIPT 1) - set(LTDL_SHLIB_EXT ".so") endif(APPLE) - set(EXEEXT "") # FIXME: Maximum path length is currently set to 'safe' fixed value set(MAXPATHLEN 2024) else(UNIX) @@ -72,6 +67,10 @@ else(WIN32) endif(UNIX) endif(WIN32) +set(EXEEXT ${CMAKE_EXECUTABLE_SUFFIX}) +set(LTDL_SHLIB_EXT ${CMAKE_SHARED_LIBRARY_SUFFIX}) +set(LLVM_PLUGIN_EXT ${CMAKE_SHARED_MODULE_SUFFIX}) + function(add_flag_or_print_warning flag) check_c_compiler_flag(${flag} C_SUPPORTS_FLAG) check_cxx_compiler_flag(${flag} CXX_SUPPORTS_FLAG) -- cgit v1.2.3