diff options
author | Joe Hildebrand <joe-github@cursive.net> | 2015-03-31 00:21:21 -0600 |
---|---|---|
committer | Joe Hildebrand <joe-github@cursive.net> | 2015-03-31 00:21:21 -0600 |
commit | 7c6c3569f73a22882b4d26d2c5cf74b8d2a531f6 (patch) | |
tree | 558d9cc71ed74fda45c4f4e123915b08465ec110 /CMakeLists.txt | |
parent | beee57de2a891ac8cdb206bb69aa838c19b99d50 (diff) | |
download | platform_external_cn-cbor-7c6c3569f73a22882b4d26d2c5cf74b8d2a531f6.tar.gz platform_external_cn-cbor-7c6c3569f73a22882b4d26d2c5cf74b8d2a531f6.tar.bz2 platform_external_cn-cbor-7c6c3569f73a22882b4d26d2c5cf74b8d2a531f6.zip |
cmake working
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..e44b4c0 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,101 @@ +# +# +# top level build file for cn-cbor + +## prepare CMAKE +cmake_minimum_required ( VERSION 3.0.0 ) + +set ( VERSION_MAJOR 0 CACHE STRING "Project major version number") +set ( VERSION_MINOR "1" CACHE STRING "Project minor version number" ) +set ( VERSION_PATCH "0" CACHE STRING "Project patch version number" ) +set ( CN_VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" ) +mark_as_advanced(VERSION_MAJOR VERSION_MINOR VERSION_PATCH CN_VERSION) + +project ( "cn-cbor" VERSION "${CN_VERSION}") + +find_package(Doxygen) + +## setup options +option ( use_context "Use context pointer for CBOR functions" OFF ) +option ( verbose "Produce verbose makefile output" OFF ) +option ( optimize "Set high optimization level" OFF ) +option ( fatal_warnings "Treat build warnings as errors" ON ) +option ( coveralls "Generate coveralls data" ON ) +option ( coveralls_send "Send data to coveralls site" OFF ) +option ( build_docs "Create docs using Doxygen" ${DOXYGEN_FOUND} ) + +set ( dist_dir ${CMAKE_BINARY_DIR}/dist ) +set ( prefix ${CMAKE_INSTALL_PREFIX} ) +set ( exec_prefix ${CMAKE_INSTALL_PREFIX}/bin ) +set ( libdir ${CMAKE_INSTALL_PREFIX}/lib ) +set ( includedir ${CMAKE_INSTALL_PREFIX}/include ) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cn-cbor.pc.in + ${CMAKE_CURRENT_BINARY_DIR}/cn-cbor.pc @ONLY) +install (FILES ${CMAKE_CURRENT_BINARY_DIR}/cn-cbor.pc DESTINATION lib/pkgconfig ) + +set ( package_prefix "${CMAKE_PACKAGE_NAME}-${CMAKE_SYSTEM_NAME}" ) + +set ( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${dist_dir}/bin ) +set ( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${dist_dir}/lib ) +set ( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${dist_dir}/lib ) +set ( CMAKE_BUILD_TYPE Debug ) + +if ( verbose ) + set ( CMAKE_VERBOSE_MAKEFILE ON ) +endif () + +## include the parts +add_subdirectory ( include ) +add_subdirectory ( src ) +add_subdirectory ( test ) + +install (FILES LICENSE README.md DESTINATION .) + +## setup packaging +set ( CPACK_GENERATOR "TGZ" ) +set ( CPACK_PACKAGE_VERSION "${PROJECT_VERSION}" ) +set ( CPACK_SOURCE_GENERATOR "TGZ" ) +set ( CPACK_SOURCE_IGNORE_FILES "/\\\\.git/" ) +file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/.gitignore igs) +foreach (ig IN ITEMS ${igs}) + # remove comments + string ( REGEX REPLACE "^\\s*#.*" "" ig "${ig}") + # remove any other whitespace + string ( STRIP "${ig}" ig) + # anything left? + if (ig) + # dots are literal + string ( REPLACE "." "\\\\." ig "${ig}" ) + # stars are on thars + string ( REPLACE "*" ".*" ig "${ig}" ) + list ( APPEND CPACK_SOURCE_IGNORE_FILES "/${ig}/" ) + endif() +endforeach() + +set ( CPACK_PACKAGE_DESCRIPTION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/README.md ) +set ( CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE" ) + +include ( CPack ) +include ( CTest ) + +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake) +include ( LCov ) + +if (build_docs) + if(NOT DOXYGEN_FOUND) + message(FATAL_ERROR "Doxygen is needed to build the documentation.") + endif() + + set(doxyfile_in ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in) + set(doxyfile ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) + + configure_file(${doxyfile_in} ${doxyfile} @ONLY) + + add_custom_target(doc + COMMAND ${DOXYGEN_EXECUTABLE} ${doxyfile} + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} + COMMENT "Generating API documentation with Doxygen" + VERBATIM) + + install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html DESTINATION share/doc) +endif() |