3.4.3 : Le CMakeLists.txt
Voici le CMakeLists.txt : On commence par récupérer toutes les sources noteDans notre cas nous n'en avons qu'une seule, mais ça gagne beaucoup de temps d'avoir l'habitude de le faire :
1 |
file(GLOB shadok_SRC "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp") |
On créé notre bibliothèque (avec la fonction définie dans la section 3.2.1.6) :
1 |
phoenix_add_library(shadok ${shadok_SRC}) |
On installe la bibliothèque binaire :
1 |
install(TARGETS shadok LIBRARY DESTINATION ${LIBRARY_DIRECTORY} ARCHIVE DESTINATION ${LIBRARY_DIRECTORY}) |
On récupère tous les headers noteil n'y en a aussi qu'un mais c'est très utile quand il y en a plein :
1 |
file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h") |
Finalement, on installe les headers :
1 |
install(FILES ${headers} DESTINATION include/TestProjectReleaseOnTag) |
Le fichier CMakeLists.txt complet :
1 2 3 4 5 6 7 8 |
file(GLOB shadok_SRC "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp") phoenix_add_library(shadok ${shadok_SRC}) install(TARGETS shadok LIBRARY DESTINATION ${LIBRARY_DIRECTORY} ARCHIVE DESTINATION ${LIBRARY_DIRECTORY}) file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h") install(FILES ${headers} DESTINATION include/TestProjectReleaseOnTag) |