Author: labath Date: Thu Feb 28 08:04:54 2019 New Revision: 355103 URL: http://llvm.org/viewvc/llvm-project?rev=355103&view=rev Log: [cmake] Move LLDB_DISABLE_LIBEDIT handling code into a central place
This was previously scattered between the main CMakeLists.txt file and LLDBGenerateConfig.cmake and LLDBConfig.cmake. This caused the some of the code to be executed in incorrect order. Specifically, the check for el_winsertstr was done before libedit_LIBRARIES was computed, and so it always failed on the first run. Moving it the two checks to a central place makes sure this doesn't happen again and improves the overall readability. Modified: lldb/trunk/CMakeLists.txt lldb/trunk/cmake/modules/LLDBConfig.cmake lldb/trunk/cmake/modules/LLDBGenerateConfig.cmake Modified: lldb/trunk/CMakeLists.txt URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=355103&r1=355102&r2=355103&view=diff ============================================================================== --- lldb/trunk/CMakeLists.txt (original) +++ lldb/trunk/CMakeLists.txt Thu Feb 28 08:04:54 2019 @@ -22,12 +22,6 @@ else() add_definitions( -DLLDB_CONFIGURATION_RELEASE ) endif() -if (LLDB_DISABLE_LIBEDIT) - add_definitions( -DLLDB_DISABLE_LIBEDIT ) -else() - find_package(LibEdit REQUIRED) -endif() - if(APPLE) add_definitions(-DLLDB_USE_OS_LOG) endif() Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBConfig.cmake?rev=355103&r1=355102&r2=355103&view=diff ============================================================================== --- lldb/trunk/cmake/modules/LLDBConfig.cmake (original) +++ lldb/trunk/cmake/modules/LLDBConfig.cmake Thu Feb 28 08:04:54 2019 @@ -1,4 +1,5 @@ include(CheckCXXSymbolExists) +include(CheckTypeSize) set(LLDB_PROJECT_ROOT ${CMAKE_CURRENT_SOURCE_DIR}) set(LLDB_SOURCE_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/source") @@ -91,6 +92,29 @@ if (LLDB_DISABLE_CURSES) add_definitions( -DLLDB_DISABLE_CURSES ) endif() +if (LLDB_DISABLE_LIBEDIT) + add_definitions( -DLLDB_DISABLE_LIBEDIT ) +else() + find_package(LibEdit REQUIRED) + + # Check if we libedit capable of handling wide characters (built with + # '--enable-widec'). + set(CMAKE_REQUIRED_LIBRARIES ${libedit_LIBRARIES}) + set(CMAKE_REQUIRED_INCLUDES ${libedit_INCLUDE_DIRS}) + check_symbol_exists(el_winsertstr histedit.h LLDB_EDITLINE_USE_WCHAR) + set(CMAKE_EXTRA_INCLUDE_FILES histedit.h) + check_type_size(el_rfunc_t LLDB_EL_RFUNC_T_SIZE) + if (LLDB_EL_RFUNC_T_SIZE STREQUAL "") + set(LLDB_HAVE_EL_RFUNC_T 0) + else() + set(LLDB_HAVE_EL_RFUNC_T 1) + endif() + set(CMAKE_REQUIRED_LIBRARIES) + set(CMAKE_REQUIRED_INCLUDES) + set(CMAKE_EXTRA_INCLUDE_FILES) +endif() + + # On Windows, we can't use the normal FindPythonLibs module that comes with CMake, # for a number of reasons. # 1) Prior to MSVC 2015, it is only possible to embed Python if python itself was Modified: lldb/trunk/cmake/modules/LLDBGenerateConfig.cmake URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBGenerateConfig.cmake?rev=355103&r1=355102&r2=355103&view=diff ============================================================================== --- lldb/trunk/cmake/modules/LLDBGenerateConfig.cmake (original) +++ lldb/trunk/cmake/modules/LLDBGenerateConfig.cmake Thu Feb 28 08:04:54 2019 @@ -4,7 +4,6 @@ include(CheckSymbolExists) include(CheckIncludeFile) include(CheckIncludeFiles) include(CheckLibraryExists) -include(CheckTypeSize) set(CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE) check_symbol_exists(ppoll poll.h HAVE_PPOLL) @@ -28,24 +27,6 @@ if(NOT UNIX) set(LLDB_DISABLE_POSIX 1) endif() -if (NOT LLDB_DISABLE_LIBEDIT) - # Check if we libedit capable of handling wide characters (built with - # '--enable-widec'). - set(CMAKE_REQUIRED_LIBRARIES ${libedit_LIBRARIES}) - set(CMAKE_REQUIRED_INCLUDES ${libedit_INCLUDE_DIRS}) - check_symbol_exists(el_winsertstr histedit.h LLDB_EDITLINE_USE_WCHAR) - set(CMAKE_EXTRA_INCLUDE_FILES histedit.h) - check_type_size(el_rfunc_t LLDB_EL_RFUNC_T_SIZE) - if (LLDB_EL_RFUNC_T_SIZE STREQUAL "") - set(LLDB_HAVE_EL_RFUNC_T 0) - else() - set(LLDB_HAVE_EL_RFUNC_T 1) - endif() - set(CMAKE_REQUIRED_LIBRARIES) - set(CMAKE_REQUIRED_INCLUDES) - set(CMAKE_EXTRA_INCLUDE_FILES) -endif() - if(NOT LLDB_CONFIG_HEADER_INPUT) set(LLDB_CONFIG_HEADER_INPUT ${LLDB_INCLUDE_ROOT}/lldb/Host/Config.h.cmake) endif() _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits