diff --git a/CMakeLists.txt b/CMakeLists.txt index 3a1a8726..57a8c55b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,217 +1,189 @@ cmake_minimum_required(VERSION 3.7.2) if(POLICY CMP0048) cmake_policy(SET CMP0048 NEW) endif(POLICY CMP0048) project( kbibtex VERSION "0.9.50" ) set( QT_MIN_VERSION "5.9.0" ) set( KF5_MIN_VERSION "5.51.0" ) find_package(ECM 5.19 REQUIRED NO_MODULE) add_definitions( -DTRANSLATION_DOMAIN="kbibtex" -DHAVE_QTWIDGETS -DHAVE_KF5 -DHAVE_ICU ) set( CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_MODULE_PATH} ) include(KDEInstallDirs) include(KDECompilerSettings NO_POLICY_SCOPE) include(KDECMakeSettings) include(ECMGenerateHeaders) include(ECMInstallIcons) include(ECMSetupVersion) include(ECMAddAppIcon) include(GenerateExportHeader) find_package( Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED Core Widgets Network XmlPatterns Concurrent NetworkAuth OPTIONAL_COMPONENTS WebEngineWidgets WebKitWidgets Test ) if (MSVC) MESSAGE( STATUS "Disabling building tests when using Microsoft Visual Studio C++ compiler" ) # Note to any developer: Try to enable building tests and see which issues you may encounter. # Examples may include: (1) char* texts which exceed the size limit supported by MSVC which # is about 2^16 bytes and (2) characters in strings written in \uXXXX notation not supported # in 1252 encoding as assumed by MSVC for C++ source files. SET(BUILD_TESTING OFF) endif (MSVC) if(BUILD_TESTING AND NOT Qt5Test_FOUND) message(STATUS "Disabling building tests as Qt5::Test library is not available" ) set(BUILD_TESTING OFF) endif() if( BUILD_TESTING ) if (WRITE_RAWDATAFILE) add_definitions(-DWRITE_RAWDATAFILE) endif(WRITE_RAWDATAFILE) set( TESTSET_DIRECTORY "" CACHE PATH "Directory where the local checkout of Git repository 'kbibtex-testset' is located" ) endif( BUILD_TESTING ) find_package( KF5 ${KF5_MIN_VERSION} REQUIRED I18n XmlGui KIO IconThemes ItemViews Completion Parts CoreAddons Service Wallet Crash ) find_package(KF5DocTools) find_package(KF5TextEditor NO_MODULE) ecm_setup_version( PROJECT VARIABLE_PREFIX KBIBTEX SOVERSION ${KBIBTEX_VERSION_MAJOR} VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/kbibtex-version.h" ) if((${KBIBTEX_VERSION_PATCH} GREATER 50) OR (${KBIBTEX_VERSION_PATCH} EQUAL 50)) # If the version number indicates a pre-release version such as # '0.7.90', i.e. a beta version for the major release 0.8, # increment release version from 0.7 to 0.8 math(EXPR KBIBTEX_RELEASE_VERSION_MINOR "${KBIBTEX_VERSION_MINOR} + 1") set( KBIBTEX_RELEASE_VERSION ${KBIBTEX_VERSION_MAJOR}.${KBIBTEX_RELEASE_VERSION_MINOR} ) else((${KBIBTEX_VERSION_PATCH} GREATER 50) OR (${KBIBTEX_VERSION_PATCH} EQUAL 50)) set( KBIBTEX_RELEASE_VERSION ${KBIBTEX_VERSION_MAJOR}.${KBIBTEX_VERSION_MINOR} ) endif((${KBIBTEX_VERSION_PATCH} GREATER 50) OR (${KBIBTEX_VERSION_PATCH} EQUAL 50)) option( UNITY_BUILD "Compile multiple C++ files in one big, merged file (\"Unity build\")\nSee also http://t-fischer.dreamwidth.org/3054.html" ) if(UNITY_BUILD) message(STATUS "Unity build enabled") else(UNITY_BUILD) message(STATUS "Unity build disabled (default), use option UNITY_BUILD to enable it") endif(UNITY_BUILD) -# # FIXME may have to be cleaned up a little bit -# # Contributed by Jeremy Cribb -# if( -# APPLE -# ) -# find_library( -# SYS_CONFIG_LIBRARY -# SystemConfiguration -# ) -# mark_as_advanced( -# SYS_CONFIG_LIBRARY -# ) -# # SET(TARGET_EXTERNAL_LIBRARIES iconv ${SYS_CONFIG_LIBRARY}) -# set( -# ICONV_INCLUDE_DIR -# "/opt/local/include" -# ) -# set( -# ICONV_LIBRARIES -# "/opt/local/lib/libiconv.dylib" -# ) -# set( -# LIBXSLT_LIBRARIES -# "/opt/local/lib/libxslt.dylib" -# ) -# endif( -# APPLE -# ) find_package( Poppler REQUIRED COMPONENTS Qt5 ) find_package( ICU REQUIRED COMPONENTS uc i18n ) if( ICU_FOUND ) message( STATUS "Found ICU " ${ICU_VERSION} ) include_directories(${ICU_INCLUDE_DIRS}) endif( ICU_FOUND ) add_subdirectory( config ) add_subdirectory( src ) add_subdirectory( xslt ) add_subdirectory( mime ) if(KF5DocTools_FOUND) add_subdirectory(doc) endif() # macro_optional_add_subdirectory( # po # ) feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index de26fb22..c780f4cd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,66 +1,57 @@ # "Unity build" found at # https://cheind.wordpress.com/2009/12/10/reducing-compilation-time-unity-builds/ function(enable_unity_build UB_SUFFIX SOURCE_VARIABLE_NAME) set(files ${${SOURCE_VARIABLE_NAME}}) # Generate a unique filename for the unity build translation unit set(unit_build_file ${CMAKE_CURRENT_BINARY_DIR}/ub_${UB_SUFFIX}.cpp) # Exclude all translation units from compilation set_source_files_properties(${files} PROPERTIES HEADER_FILE_ONLY true) # Open the ub file file(WRITE ${unit_build_file} "// Unity Build generated by CMake\n") # Add include statement for each translation unit foreach(source_file ${files}) file(APPEND ${unit_build_file} "#include <${source_file}>\n") endforeach(source_file) # Complement list of translation units with the name of ub set(${SOURCE_VARIABLE_NAME} ${${SOURCE_VARIABLE_NAME}} ${unit_build_file} PARENT_SCOPE) endfunction(enable_unity_build) # Creates kbibtex-git-info.h containing information about the source code's Git revision # (if source directory is a Git clone) add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/kbibtex-git-info.h COMMAND ${CMAKE_COMMAND} -DSOURCE_DIR=${CMAKE_SOURCE_DIR} -DBINARY_DIR=${CMAKE_BINARY_DIR} -P ${CMAKE_CURRENT_SOURCE_DIR}/getgit.cmake COMMENT "Determine Git revision in case this source code is a Git checkout" ) set_source_files_properties( ${CMAKE_CURRENT_BINARY_DIR}/kbibtex-git-info.h PROPERTIES GENERATED 1 HEADER_FILE_ONLY 1 SKIP_AUTOMOC ON SKIP_AUTOUIC ON SKIP_AUTOGEN ON ) add_custom_target(generate-kbibtex-git-info DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/kbibtex-git-info.h ) add_subdirectory(global) add_subdirectory(config) add_subdirectory(data) add_subdirectory(io) add_subdirectory(processing) add_subdirectory(networking) add_subdirectory(gui) add_subdirectory(program) add_subdirectory(parts) if(BUILD_TESTING) add_subdirectory(test) endif() - -# install( -# FILES -# kbibtexnamespace.h -# DESTINATION -# ${INCLUDE_INSTALL_DIR}/kbibtex -# COMPONENT -# development -# )