From aea50ce97cf8bf8356588d771acce68d2eb6021b Mon Sep 17 00:00:00 2001 From: David Majnemer Date: Mon, 7 Jul 2014 20:29:00 +0000 Subject: [PATCH] CMake: Let LLDB build with CMake 3 Teach add_lldb_library to correctly use the CMake 2.8.12 PUBLIC/PRIVATE/INTERFACE keywords. LLDB's CMake configuration would inconsistently apply these keywords; this was previously a warning in CMake 2.x but became an error in CMake 3. llvm-svn: 212482 --- lldb/CMakeLists.txt | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt index 69b66bc..b4fe92a 100644 --- a/lldb/CMakeLists.txt +++ b/lldb/CMakeLists.txt @@ -226,7 +226,7 @@ macro(add_lldb_library name) ##add_dependencies(${name} ${LLVM_COMMON_DEPENDS}) #endif() - if (CMAKE_VERSION VERSION_LESS 2.8.12 OR NOT "${libkind}" STREQUAL "STATIC") + if (CMAKE_VERSION VERSION_LESS 2.8.12) set(cmake_2_8_12_INTERFACE) set(cmake_2_8_12_PRIVATE) set(cmake_2_8_12_PUBLIC) @@ -236,19 +236,25 @@ macro(add_lldb_library name) set(cmake_2_8_12_PUBLIC PUBLIC) endif () + if ("${libkind}" STREQUAL "STATIC") + set(lldb_library_keyword ${cmake_2_8_12_INTERFACE}) + else () + set(lldb_library_keyword ${cmake_2_8_12_PUBLIC}) + endif () + if(LLDB_USED_LIBS) # The Darwin linker doesn't understand --start-group/--end-group. if (LLVM_COMPILER_IS_GCC_COMPATIBLE AND NOT "${CMAKE_SYSTEM_NAME}" MATCHES "Darwin") - target_link_libraries(${name} ${cmake_2_8_12_PUBLIC} + target_link_libraries(${name} ${lldb_library_keyword} -Wl,--start-group ${LLDB_USED_LIBS} -Wl,--end-group) else() - target_link_libraries(${name} ${cmake_2_8_12_PUBLIC} ${LLDB_USED_LIBS}) + target_link_libraries(${name} ${lldb_library_keyword} ${LLDB_USED_LIBS}) endif() endif() - target_link_libraries(${name} ${cmake_2_8_12_PUBLIC} ${CLANG_USED_LIBS}) - target_link_libraries(${name} ${LLVM_USED_LIBS}) + target_link_libraries(${name} ${lldb_library_keyword} ${CLANG_USED_LIBS}) + target_link_libraries(${name} ${lldb_library_keyword} ${LLVM_USED_LIBS}) llvm_config(${name} ${LLVM_LINK_COMPONENTS}) - target_link_libraries(${name} ${LLVM_COMMON_LIBS}) + target_link_libraries(${name} ${lldb_library_keyword} ${LLVM_COMMON_LIBS}) if (LLVM_COMMON_DEPENDS) add_dependencies(${name} ${LLVM_COMMON_DEPENDS}) endif() -- 2.7.4