From de142f6c74aa4d1d793c3e9781bdb0df320513a5 Mon Sep 17 00:00:00 2001 From: RougherO Date: Fri, 7 Jun 2024 22:12:13 +0530 Subject: [PATCH] Modified CMakeLists.txt to package the project --- CMakeLists.txt | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 184ecf4..19c720a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,10 @@ -cmake_minimum_required(VERSION 3.21.0) +cmake_minimum_required(VERSION 3.27.0) # set output filename here set(NAME_TARGET DoublePendulum) +set(VERSION_TARGET 2.0.1) project(${NAME_TARGET} LANGUAGES CXX) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # ---------------------------- # set all project files here @@ -35,15 +37,31 @@ if(NOT EXISTS ${CMAKE_SOURCE_DIR}/submodules/SFML/CMakeLists.txt) endif() set(SFML_BUILD_AUDIO OFF) set(SFML_BUILD_NETWORK OFF) -add_subdirectory(${CMAKE_SOURCE_DIR}/submodules/SFML SFML/build/) +add_subdirectory(${CMAKE_SOURCE_DIR}/submodules/SFML SFML/build EXCLUDE_FROM_ALL) set(IMGUI_DIR ${CMAKE_SOURCE_DIR}/submodules/ImGui/) set(IMGUI_SFML_FIND_SFML OFF) -add_subdirectory(${CMAKE_SOURCE_DIR}/submodules/ImGui-SFML ImGui-SFML/build) +add_subdirectory(${CMAKE_SOURCE_DIR}/submodules/ImGui-SFML ImGui-SFML/build EXCLUDE_FROM_ALL) # ---------------------------- # set lib files here set(LIB_FILES sfml-graphics sfml-window sfml-system ImGui-SFML) target_link_libraries(${NAME_TARGET} ${LIB_FILES}) -# ---------------------------- \ No newline at end of file +# ---------------------------- + +# CPack configuration +set(CPACK_GENERATOR ZIP TGZ) +set(CPACK_PACKAGE_NAME ${NAME_TARGET}) +set(CPACK_PACKAGE_VERSION ${VERSION_TARGET}) +set(CPACK_PACKAGE_CONTACT "roughero2@gmail.com") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Double Pendulum Simulation") +set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}") +set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-source") +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE") +set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md") + +include(CPack) + +# Specify the install directories for the executable and libraries +install(TARGETS ${NAME_TARGET} DESTINATION bin) \ No newline at end of file