CMakeLists.txt 1.16 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
# List all required files here (cmake best practice to NOT automate this step!)
add_library(pls STATIC
            src/library.cpp include/pls/library.h)

# Add everything in `./include` to be in the include path of this project
target_include_directories(pls
        PUBLIC
            $<INSTALL_INTERFACE:include>
            $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
        PRIVATE
            ${CMAKE_CURRENT_SOURCE_DIR}/src # TODO: Set this up when we require private headers
)

# Add cmake dependencies here if needed
target_link_libraries(pls
        Threads::Threads # pthread support
)

# Rules for istalling the library on a system
# ...binaries
install(TARGETS pls
        LIBRARY
            DESTINATION lib
        ARCHIVE
            DESTINATION lib
)
# ...all headers in `include`
INSTALL (
        DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
        DESTINATION include
        FILES_MATCHING PATTERN "*.h*"
)

# Enable warnings/tidy code checking from our compiler
target_compile_options(pls PRIVATE
        $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:AppleClang>,$<CXX_COMPILER_ID:GNU>>:
        -Wall>
        $<$<CXX_COMPILER_ID:MSVC>:
        -W4>)