Rewrite parts of CMakeLists.txt.

This commit is contained in:
2026-03-31 11:17:27 +02:00
parent 4046f6dfd5
commit 978bf41ab0

View File

@@ -15,10 +15,12 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
cmake_minimum_required(VERSION 3.10) cmake_minimum_required(VERSION 3.10)
project(SpaceShipSim C) project(spaceshipsim
VERSION 0.6
set(TARGET_NAME "spaceshipsim") SPDX_LICENSE "GPL-3.0-or-later"
set(TARGET_VERSION "0.6") DESCRIPTION "A simulation of a 2D space ship in the frictionless environment of space."
HOMEPAGE_URL "https://code.ortegas.org/nortega/spaceshipsim"
LANGUAGES C)
if(NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "release") set(CMAKE_BUILD_TYPE "release")
@@ -42,13 +44,22 @@ include_directories(
SYSTEM ${ALLEG5_INCLUDE_DIRS}) SYSTEM ${ALLEG5_INCLUDE_DIRS})
set(SRCS set(SRCS
src/event_manager.c "src/event_manager.c"
src/main.c "src/main.c"
src/planet.c "src/planet.c"
src/ship.c "src/ship.c"
src/starfield.c) "src/starfield.c"
)
add_definitions(-DVERSION="${TARGET_VERSION}") set(HDRS
"src/event_manager.h"
"src/globals.h"
"src/planet.h"
"src/ship.h"
"src/starfield.h"
)
add_definitions(-DVERSION="${PROJECT_VERSION}")
if(${CMAKE_BUILD_TYPE} STREQUAL "debug" OR ${CMAKE_BUILD_TYPE} STREQUAL "relwithdebinfo") if(${CMAKE_BUILD_TYPE} STREQUAL "debug" OR ${CMAKE_BUILD_TYPE} STREQUAL "relwithdebinfo")
add_definitions(-DDEBUG) add_definitions(-DDEBUG)
@@ -56,14 +67,14 @@ else()
add_definitions(-DNDEBUG) add_definitions(-DNDEBUG)
endif() endif()
add_executable(${TARGET_NAME} ${SRCS}) add_executable(${PROJECT_NAME} ${SRCS} ${HDRS})
target_link_libraries(${TARGET_NAME} target_link_libraries(${PROJECT_NAME}
m # math library m # math library
${ALLEG5_LIBRARIES} ${ALLEG5_LIBRARIES}
${ALLEG5-PRIM_LIBRARIES} ${ALLEG5-PRIM_LIBRARIES}
${ALLEG5-FONT_LIBRARIES}) ${ALLEG5-FONT_LIBRARIES})
install(TARGETS ${TARGET_NAME} install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION bin/ RUNTIME DESTINATION bin/
CONFIGURATIONS release minsizerel) CONFIGURATIONS release minsizerel)