5.8.5.4 : Le CMakeLists.txt
Écrivons le fichier CMakeLists.txt :
On récupère toutes les sources :
1 |
file(GLOB mainSource "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp") |
On créé notre bibliothèque :
1 |
add_library(gray_scott_data_format SHARED ${mainSource}) |
On change les options de compilation :de cette manière car nous aurons besoin par la suite de compiler avec différentes options nos autres programmes et bibliothèque :
1 |
set_property(TARGET gray_scott_data_format PROPERTY COMPILE_FLAGS "-O3") |
On ajoute les dépendences de notre bibliothèque :
1 |
target_link_libraries(gray_scott_data_format ${HDF5_CXX_LIBRARIES}) |
Le fichier CMakeLists.txt complet :
1 2 3 4 |
file(GLOB mainSource "${CMAKE_CURRENT_SOURCE_DIR}/*.cpp") add_library(gray_scott_data_format SHARED ${mainSource}) set_property(TARGET gray_scott_data_format PROPERTY COMPILE_FLAGS "-O3") target_link_libraries(gray_scott_data_format ${HDF5_CXX_LIBRARIES}) |
Vous pouvez le télécharger ici.