diff options
author | Deniz Bahadir <Bagira80@users.noreply.github.com> | 2020-07-29 14:06:02 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-29 14:06:02 (GMT) |
commit | 30cfbe69de24e6d1d6b718971168be1ac246e3e2 (patch) | |
tree | 2083d8a8b7ae0e8cb66d065b28ea4a69a276e029 | |
parent | 517ec716de0f3a08fcd3bed2626b776a36c663f5 (diff) | |
download | Doxygen-30cfbe69de24e6d1d6b718971168be1ac246e3e2.zip Doxygen-30cfbe69de24e6d1d6b718971168be1ac246e3e2.tar.gz Doxygen-30cfbe69de24e6d1d6b718971168be1ac246e3e2.tar.bz2 |
Fix compiling with clang parser support and with Clang compiler, too (#7922)
* Fix compiling with clang parser support and with Clang compiler, too
When compiling the code with the Clang compiler a new CMake option
`use_libc++` is available which is enabled by default. It determines if
the Clang compiler should use libc++ as its C++ standard library or uses
the systems default (e.g. libstdc++ on Linux).
Disabling that option might help when compiling with Clang and the
option `use_libclang` is enabled but the associated library was not
built with libc++ as its C++ standard library.
Additionally, the doxygen executable that is created when CMake option
`static_libclang` is enabled, no longer crashes.
* Removing obsolete (and wrong) forcing of -std=c++11 for GCC
The entire Doxygen project already requires the compiler to run in C++14
mode. That setting is applied globally in the top-most `CMakeLists.txt`
file.
Therefore, forcing GCC to run in C++11 mode in `src/CMakeLists.txt` is
wrong and obsolete.
-rw-r--r-- | CMakeLists.txt | 3 | ||||
-rw-r--r-- | src/CMakeLists.txt | 18 |
2 files changed, 11 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e76a745..35e6a0c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,9 @@ option(build_search "Build external search tools (doxysearch and doxyindexer) option(build_doc "Build user manual (HTML and PDF)" OFF) option(build_doc_chm "Build user manual (CHM)" OFF) option(use_sqlite3 "Add support for sqlite3 output [experimental]." OFF) +if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + option(use_libc++ "Use libc++ as C++ standard library." ON) +endif() option(use_libclang "Add support for libclang parsing." OFF) option(static_libclang "Link to a statically compiled version of LLVM/libclang." OFF) option(win_static "Link with /MT in stead of /MD on windows" OFF) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5ba80b7..8b11a2d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -322,25 +322,23 @@ if (use_libclang) cmake_minimum_required(VERSION 3.1) target_compile_features(doxymain PRIVATE cxx_alignof) target_compile_features(doxygen PRIVATE cxx_alignof) - target_compile_options(doxymain PRIVATE -stdlib=libc++) - target_compile_options(doxygen PRIVATE -stdlib=libc++) - elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - target_compile_options(doxymain PRIVATE -std=c++11) - target_compile_options(doxygen PRIVATE -std=c++11) + if (use_libc++) + target_compile_options(doxymain PRIVATE -stdlib=libc++) + target_compile_options(doxygen PRIVATE -stdlib=libc++) + endif() endif() include_directories(${LLVM_INCLUDE_DIRS}) add_definitions(${LLVM_DEFINITIONS}) if (static_libclang) - llvm_map_components_to_libnames(llvm_libs support core option) - set(CLANG_LIBS libclang clangTooling ${llvm_libs}) + set(CLANG_LIBS libclang clangTooling) else() # dynamically linked version of clang - llvm_map_components_to_libnames(llvm_libs support) - set(CLANG_LIBS libclang clang-cpp ${llvm_libs}) + llvm_config(doxymain USE_SHARED support) + set(CLANG_LIBS libclang clang-cpp) endif() target_compile_definitions(doxygen PRIVATE ${LLVM_DEFINITIONS}) endif() -target_link_libraries(doxygen +target_link_libraries(doxygen PRIVATE doxymain doxycfg qtools |