diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2017-10-21 14:17:22 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-21 14:17:22 (GMT) |
commit | 929ea15c46c55562862181f59ae2c6b00c046dc0 (patch) | |
tree | 4dbc9656f628f5b9096e11eb5c7c34e1865ab1fa | |
parent | af7dfa6d51dcbdbcba4196c244e4609ff249d83c (diff) | |
parent | fcf5fecb64d5c194430e10cbe52482b14224d645 (diff) | |
download | Doxygen-929ea15c46c55562862181f59ae2c6b00c046dc0.zip Doxygen-929ea15c46c55562862181f59ae2c6b00c046dc0.tar.gz Doxygen-929ea15c46c55562862181f59ae2c6b00c046dc0.tar.bz2 |
Merge pull request #615 from DerDakon/cmake-cleanup
clean up CMake code
-rw-r--r-- | .travis.yml | 2 | ||||
-rw-r--r-- | CMakeLists.txt | 50 | ||||
-rw-r--r-- | addon/CMakeLists.txt | 17 | ||||
-rw-r--r-- | addon/doxyapp/CMakeLists.txt | 4 | ||||
-rw-r--r-- | addon/doxyparse/CMakeLists.txt | 4 | ||||
-rw-r--r-- | addon/doxysearch/CMakeLists.txt | 4 | ||||
-rw-r--r-- | addon/doxywizard/CMakeLists.txt | 6 | ||||
-rw-r--r-- | doc/CMakeLists.txt | 13 | ||||
-rw-r--r-- | examples/CMakeLists.txt | 8 | ||||
-rw-r--r-- | src/CMakeLists.txt | 10 | ||||
-rw-r--r-- | testing/CMakeLists.txt | 9 |
11 files changed, 53 insertions, 74 deletions
diff --git a/.travis.yml b/.travis.yml index acc325a..09f5af9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,5 +19,5 @@ script: - cd build - cmake -G "Unix Makefiles" -Dbuild_doc=ON -Dbuild_wizard=ON .. - make - - make tests + - ctest -V - make docs diff --git a/CMakeLists.txt b/CMakeLists.txt index 05db71d..ba105b8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,12 +41,12 @@ if (use_libclang) set(clang "1" CACHE INTERNAL "used in settings.h") find_package(LLVM CONFIG REQUIRED) find_package(Clang CONFIG REQUIRED) - if (${CMAKE_SYSTEM} MATCHES "Darwin") + if (CMAKE_SYSTEM MATCHES "Darwin") set(MACOS_VERSION_MIN 10.11) endif() endif() -if (${CMAKE_SYSTEM} MATCHES "Darwin") +if (CMAKE_SYSTEM MATCHES "Darwin") set(CMAKE_CXX_FLAGS "-Wno-deprecated-register -mmacosx-version-min=${MACOS_VERSION_MIN} ${CMAKE_CXX_FLAGS}") set(CMAKE_C_FLAGS "-Wno-deprecated-register -mmacosx-version-min=${MACOS_VERSION_MIN} ${CMAKE_C_FLAGS}") find_library(CORESERVICES_LIB CoreServices) @@ -54,7 +54,7 @@ if (${CMAKE_SYSTEM} MATCHES "Darwin") endif() if (WIN32) - if (NOT "${CMAKE_GENERATOR}" MATCHES ".*MinGW Makefiles.*") + if (NOT CMAKE_GENERATOR MATCHES "MinGW Makefiles") if (NOT ICONV_DIR) set(ICONV_DIR "${CMAKE_SOURCE_DIR}/winbuild") endif() @@ -71,13 +71,13 @@ set(CMAKE_CXX_VISIBILITY_PRESET hidden) set(CMAKE_C_VISIBILITY_PRESET hidden) set(CMAKE_VISIBILITY_INLINES_HIDDEN 1) -if ("${CMAKE_GENERATOR}" MATCHES "Ninja") +if (CMAKE_GENERATOR MATCHES "Ninja") set(LEX_FLAGS ) set(YACC_FLAGS ) -else ("${CMAKE_GENERATOR}" MATCHES "Ninja") +else () set(LEX_FLAGS $(LEX_FLAGS)) set(YACC_FLAGS $(YACC_FLAGS)) -endif ("${CMAKE_GENERATOR}" MATCHES "Ninja") +endif () find_program(DOT NAMES dot) find_package(PythonInterp REQUIRED) @@ -99,8 +99,6 @@ set(ENV{DOXYGEN_DOCDIR} ${DOXYDOCS}) set(GENERATED_SRC "${CMAKE_BINARY_DIR}/generated_src" CACHE INTERNAL "Stores generated files") set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) -set(CUSTOM_INCLUDE_DIR "" CACHE FILEPATH "Extra include path") -set(CUSTOM_LINK_DIR "" CACHE FILEPATH "Extra library path") # place binaries for all build types in the same directory, so we know where to find it # when running tests or generating docs @@ -111,25 +109,18 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${EXECUTABLE_OUTPUT_PATH}) # gather lang codes for translation file(GLOB lang_files RELATIVE "${CMAKE_SOURCE_DIR}/src" "${CMAKE_SOURCE_DIR}/src/translator_??.h") -set(lcodes "") -foreach (_lang ${lang_files}) - string(REGEX REPLACE "translator_(.*).h" "\\1" _lang_code ${_lang}) - string(TOUPPER ${_lang_code} lang_code) - list(APPEND lcodes "${lang_code}") -endforeach() if (english_only) # user only wants English set(lcodes "ENONLY") +else () + set(lcodes "") + foreach (_lang ${lang_files}) + string(REGEX REPLACE "translator_(.*).h" "\\1" _lang_code ${_lang}) + string(TOUPPER ${_lang_code} lang_code) + list(APPEND lcodes "${lang_code}") + endforeach() endif() set(LANG_CODES ${lcodes} CACHE STRING "List of language codes for which translations should be compiled in") -if (${CUSTOM_INCLUDE_DIR}) - include_directories(${CUSTOM_INCLUDE_DIR}) -endif() - -if (${CUSTOM_LINK_DIR}) - link_directories(${CUSTOM_LINK_DIR}) -endif() - if (win_static) set(CompilerFlags CMAKE_CXX_FLAGS @@ -152,14 +143,13 @@ add_subdirectory(libmd5) add_subdirectory(qtools) add_subdirectory(vhdlparser) add_subdirectory(src) -add_subdirectory(examples) -add_subdirectory(doc) - -add_subdirectory(addon/doxmlparser) -add_subdirectory(addon/doxyapp) -add_subdirectory(addon/doxyparse) -add_subdirectory(addon/doxysearch) -add_subdirectory(addon/doxywizard) + +if (build_doc) + add_subdirectory(examples) + add_subdirectory(doc) +endif () + +add_subdirectory(addon) enable_testing() add_subdirectory(testing) diff --git a/addon/CMakeLists.txt b/addon/CMakeLists.txt new file mode 100644 index 0000000..fd8c73f --- /dev/null +++ b/addon/CMakeLists.txt @@ -0,0 +1,17 @@ +add_subdirectory(doxmlparser) + +if (build_app) + add_subdirectory(doxyapp) +endif () + +if (build_parse) + add_subdirectory(doxyparse) +endif () + +if (build_search) + add_subdirectory(doxysearch) +endif () + +if (build_wizard) + add_subdirectory(doxywizard) +endif () diff --git a/addon/doxyapp/CMakeLists.txt b/addon/doxyapp/CMakeLists.txt index 423aea6..4fd1816 100644 --- a/addon/doxyapp/CMakeLists.txt +++ b/addon/doxyapp/CMakeLists.txt @@ -1,5 +1,3 @@ -if (build_app) - # configvalues.h add_custom_command( COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/configgen.py -maph ${CMAKE_SOURCE_DIR}/src/config.xml > ${GENERATED_SRC}/configvalues.h @@ -35,5 +33,3 @@ ${CLANG_LIBS} ) install(TARGETS doxyapp DESTINATION bin) - -endif() diff --git a/addon/doxyparse/CMakeLists.txt b/addon/doxyparse/CMakeLists.txt index e4f9021..8e7536f 100644 --- a/addon/doxyparse/CMakeLists.txt +++ b/addon/doxyparse/CMakeLists.txt @@ -1,5 +1,3 @@ -if (build_parse) - # configvalues.h add_custom_command( COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/configgen.py -maph ${CMAKE_SOURCE_DIR}/src/config.xml > ${GENERATED_SRC}/configvalues.h @@ -35,5 +33,3 @@ ${CLANG_LIBS} ) install(TARGETS doxyparse DESTINATION bin) - -endif() diff --git a/addon/doxysearch/CMakeLists.txt b/addon/doxysearch/CMakeLists.txt index 33e01c1..54794a6 100644 --- a/addon/doxysearch/CMakeLists.txt +++ b/addon/doxysearch/CMakeLists.txt @@ -1,5 +1,3 @@ -if (build_search) - find_package(Xapian REQUIRED) find_package(ZLIB REQUIRED) @@ -32,5 +30,3 @@ target_link_libraries(doxysearch.cgi ) install(TARGETS doxyindexer doxysearch.cgi DESTINATION bin) - -endif() diff --git a/addon/doxywizard/CMakeLists.txt b/addon/doxywizard/CMakeLists.txt index 8207971..0907d23 100644 --- a/addon/doxywizard/CMakeLists.txt +++ b/addon/doxywizard/CMakeLists.txt @@ -1,8 +1,6 @@ -if (build_wizard) - # search for Qt5 if (NOT force_qt4) - find_package(Qt5Core QUIET) + find_package(Qt5Core QUIET CONFIG) if (Qt5Core_FOUND) message(STATUS "Using Qt5") find_package(Qt5 COMPONENTS Widgets Gui Xml) @@ -112,5 +110,3 @@ ${QT_LIBRARIES} ${QT_QTMAIN_LIBRARY} ) install(TARGETS doxywizard DESTINATION bin) - -endif() diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 8b51134..b95afd8 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -11,8 +11,6 @@ # Documents produced by Doxygen are derivative works derived from the # input used in their production; they are not affected by this license. -if (build_doc) - include (${TOP}/cmake/version.cmake) string(TIMESTAMP DATE "%d-%m-%Y") @@ -20,6 +18,7 @@ find_package(PythonInterp REQUIRED) find_program(EPSTOPDF NAMES epstopdf ) find_program(PDFLATEX NAMES pdflatex ) find_program(MAKEINDEX NAMES makeindex ) +include(GNUInstallDirs) if (doxygen_BINARY_DIR) set(DOXYGEN_EXECUTABLE ${doxygen_BINARY_DIR}/bin/doxygen) @@ -87,9 +86,9 @@ set(DOC_FILES ) file(GLOB LANG_FILES "${TOP}/src/translator_??.h") -file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/man) -file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/src) -file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/doc) +file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/man + ${PROJECT_BINARY_DIR}/src + ${PROJECT_BINARY_DIR}/doc) file(COPY ${TOP}/VERSION DESTINATION ${PROJECT_BINARY_DIR}/) file(COPY ${TOP}/src/translator.h DESTINATION ${PROJECT_BINARY_DIR}/src/) @@ -169,7 +168,7 @@ install(FILES "${PROJECT_BINARY_DIR}/man/doxywizard.1" "${PROJECT_BINARY_DIR}/man/doxysearch.1" "${PROJECT_BINARY_DIR}/man/doxyindexer.1" - DESTINATION share/man/man1 + DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 ) install(FILES @@ -181,5 +180,3 @@ install(DIRECTORY "${PROJECT_BINARY_DIR}/html" DESTINATION "${CMAKE_INSTALL_PREFIX}/${DOC_INSTALL_DIR}" ) - -endif(build_doc) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 24bcbfa..601ed5a 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,7 +1,5 @@ -if (build_doc) - -file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/examples) -file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/html/examples) +file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/examples + ${PROJECT_BINARY_DIR}/html/examples) file(GLOB EXAMPLE_FILES RELATIVE ${CMAKE_SOURCE_DIR}/examples "*") if (DOT) @@ -246,5 +244,3 @@ if (DOT) OUTPUT ${PROJECT_BINARY_DIR}/html/examples/diagrams/html/index.html ${PROJECT_BINARY_DIR}/html/examples/diagrams/latex/refman_doc.tex ) endif(DOT) - -endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3b5d3cc..5c55efa 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -248,12 +248,13 @@ add_executable(doxygen main.cpp) if (use_libclang) find_package(LLVM REQUIRED CONFIG) find_package(Clang REQUIRED CONFIG) - if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") + if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + cmake_minimum_required(VERSION 3.1) target_compile_features(_doxygen PRIVATE cxx_alignof) target_compile_features(doxygen PRIVATE cxx_alignof) - target_compile_options(_doxygen PRIVATE -stdlib=libc++ -std=c++11) - target_compile_options(doxygen PRIVATE -stdlib=libc++ -std=c++11) - elseif (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU") + target_compile_options(_doxygen PRIVATE -stdlib=libc++) + target_compile_options(doxygen PRIVATE -stdlib=libc++) + elseif (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") target_compile_options(_doxygen PRIVATE -std=c++11) target_compile_options(doxygen PRIVATE -std=c++11) endif() @@ -278,4 +279,3 @@ target_link_libraries(doxygen ) install(TARGETS doxygen DESTINATION bin) - diff --git a/testing/CMakeLists.txt b/testing/CMakeLists.txt index 21df5ab..84162ea 100644 --- a/testing/CMakeLists.txt +++ b/testing/CMakeLists.txt @@ -1,9 +1,4 @@ -find_program(XMLLINT NAMES xmllint) -find_program(DIFF NAMES diff) - -add_custom_target(tests - COMMENT "Running doxygen tests..." - COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/testing/runtests.py --all --doxygen ${PROJECT_BINARY_DIR}/bin/doxygen --inputdir ${CMAKE_SOURCE_DIR}/testing --outputdir ${PROJECT_BINARY_DIR}/testing - DEPENDS doxygen +add_test(NAME suite + COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/testing/runtests.py --all --doxygen $<TARGET_FILE:doxygen> --inputdir ${CMAKE_SOURCE_DIR}/testing --outputdir ${PROJECT_BINARY_DIR}/testing ) |