Directory navigator
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CMakeLists.txt 1.9KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # target_compile_features has been introduced in that version
  2. cmake_minimum_required (VERSION 3.1.0)
  3. project (sdn CXX)
  4. set (version 0.1)
  5. if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
  6. set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic")
  7. endif ()
  8. # Since we use a language with slow compilers, let's at least use a fast linker
  9. execute_process (COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=gold -Wl,--version
  10. ERROR_QUIET OUTPUT_VARIABLE ld_version)
  11. if ("${ld_version}" MATCHES "GNU gold")
  12. set (CMAKE_EXE_LINKER_FLAGS "-fuse-ld=gold ${CMAKE_EXE_LINKER_FLAGS}")
  13. endif ()
  14. find_package (PkgConfig REQUIRED)
  15. pkg_check_modules (NCURSESW QUIET ncursesw)
  16. add_executable (${PROJECT_NAME} ${PROJECT_NAME}.cpp)
  17. target_include_directories (${PROJECT_NAME} PUBLIC ${NCURSESW_INCLUDE_DIRS})
  18. target_link_libraries (${PROJECT_NAME} PUBLIC ${NCURSESW_LIBRARIES} acl)
  19. target_compile_features (${PROJECT_NAME} PUBLIC cxx_std_14)
  20. target_compile_definitions (${PROJECT_NAME} PUBLIC
  21. -DPROJECT_NAME=\"${PROJECT_NAME}\" -DPROJECT_VERSION=\"${version}\")
  22. include (GNUInstallDirs)
  23. install (TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
  24. install (FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR})
  25. set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Directory navigator")
  26. set (CPACK_PACKAGE_VENDOR "Premysl Janouch")
  27. set (CPACK_PACKAGE_CONTACT "Přemysl Janouch <p@janouch.name>")
  28. set (CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
  29. set (CPACK_PACKAGE_VERSION ${version})
  30. set (CPACK_GENERATOR "TGZ;ZIP")
  31. set (CPACK_PACKAGE_FILE_NAME
  32. "${PROJECT_NAME}-${version}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
  33. set (CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}-${version}")
  34. set (CPACK_SOURCE_GENERATOR "TGZ;ZIP")
  35. set (CPACK_SOURCE_IGNORE_FILES "/\\\\.git;/build;/CMakeLists.txt.user")
  36. set (CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${version}")
  37. set (CPACK_SET_DESTDIR TRUE)
  38. include (CPack)