• suokko's avatar
    Cmake build improvements for find_package(Pistache) (#795) · 4ed3f8e1
    suokko authored
    * Set default build type using _INIT variable
    
    Language support checking offers a standardized method to set default
    build type using CMAKE_BUILD_TYPE_INIT variable. The variable must be
    set before enable_language is called implicitly from project
    
    * Enable only C++ compiler
    
    * Let C++ compiler detection to check for standard support
    
    Setting CMAKE_CXX_STANDARD variables before implicit call to
    enable_language handles checking for standard support automatically.
    
    * Fix pistache_shared export
    
    Exporting targets allows find_package(Pistache) to import them
    correctly. The import makes it easier to use Pistache in a porject using
    cmake build system.
    
    * Add wildcard ignore for multiple build directories
    
    I used multiple build directories to test different configurations work.
    My alternative test configuration is a Debian Stretch chroot for an old
    distro test.
    
    * Detect Threads which is implicit requirement
    
    Static library requires PistancheConfig.cmake to detect all dependencies
    to allow simple linking to imported library to work.
    
    * Use find_package to detect OpenSSL
    
    Add OpenSSL configure time detection for the development package.
    FindOpenSSL.cmake started support IMPORTED libraries only in 3.4. The
    IMPORTED library helps users to link correctly to pistache static
    library.
    
    Headers use libssl directly which forces pistache to use public
    definition and library link.
    
    * Export include directories to IMPORTED library
    
    * Do not add pistache to global build configuration
    
    PistacheConfig shouldn't add include directories and libraries to the
    global build configuration. Imported libraries provide all required
    build configurations to a depending target.
    
    * Check if atomic library is required
    
    Pistache should link to atomic library only if system requires the
    library. The easiest method appears to be use a modified LLVM
    CheckAtomic helper.
    
    * Use target include directories for GTest
    
    * Detect libcurl and remove pthread linking
    
    * Update CMake Pistache example
    
    * Add CMake ConfigVersion file
    
    * Update the date part of version
    4ed3f8e1
CheckAtomic.cmake 2.67 KB