CMakeLists.txt 1016 B

123456789101112131415161718192021222324252627
  1. # Include apt-pkg directly, as some files have #include <system.h>
  2. include_directories(${PROJECT_BINARY_DIR}/include/apt-pkg)
  3. # Set the version of the library
  4. set(MAJOR 2.0)
  5. set(MINOR 0)
  6. set(APT_INST_MAJOR ${MAJOR} PARENT_SCOPE)
  7. # Definition of the C++ files used to build the library
  8. file(GLOB_RECURSE library "*.cc")
  9. file(GLOB_RECURSE headers "*.h")
  10. # Create a library using the C++ files
  11. add_library(apt-inst SHARED ${library})
  12. # Link the library and set the SONAME
  13. target_link_libraries(apt-inst PUBLIC apt-pkg ${CMAKE_THREAD_LIBS_INIT})
  14. target_link_libraries(apt-inst PRIVATE ${CMAKE_THREAD_LIBS_INIT})
  15. set_target_properties(apt-inst PROPERTIES VERSION ${MAJOR}.${MINOR})
  16. set_target_properties(apt-inst PROPERTIES SOVERSION ${MAJOR})
  17. add_version_script(apt-inst)
  18. # Install the library and the headers
  19. install(TARGETS apt-inst LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
  20. install(FILES ${headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/apt-pkg)
  21. flatify(${PROJECT_BINARY_DIR}/include/apt-pkg/ "${headers}")