summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-04-18 11:16:47 +0200
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-04-20 17:52:51 +0200
commitc74052c766df01eafc3cb5f98c46d779bee8b0e9 (patch)
treefb20474973c2e7941a13964b898b7724aa141fed /tools
parent5e400c91b7ac292dd8a555c9c2f18075fd778d78 (diff)
downloadmana-c74052c766df01eafc3cb5f98c46d779bee8b0e9.tar.gz
mana-c74052c766df01eafc3cb5f98c46d779bee8b0e9.tar.bz2
mana-c74052c766df01eafc3cb5f98c46d779bee8b0e9.tar.xz
mana-c74052c766df01eafc3cb5f98c46d779bee8b0e9.zip
CMake: Use cmake-format to make the files more pleasant to read
More consistent formatting and no longer everything in uppercase, yay!
Diffstat (limited to 'tools')
-rw-r--r--tools/dyecmd/CMakeLists.txt43
-rw-r--r--tools/dyecmd/src/CMakeLists.txt97
2 files changed, 64 insertions, 76 deletions
diff --git a/tools/dyecmd/CMakeLists.txt b/tools/dyecmd/CMakeLists.txt
index 48566648..309420d2 100644
--- a/tools/dyecmd/CMakeLists.txt
+++ b/tools/dyecmd/CMakeLists.txt
@@ -1,28 +1,29 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+cmake_minimum_required(VERSION 2.6)
-PROJECT(MANA_DYECOMMAND)
+project(MANA_DYECOMMAND)
-IF (NOT VERSION)
- SET(VERSION 1.0.0)
-ENDIF()
+if(NOT VERSION)
+ set(VERSION 1.0.0)
+endif()
-STRING(REPLACE "." " " _VERSION ${VERSION})
-SEPARATE_ARGUMENTS(_VERSION)
-LIST(LENGTH _VERSION _LEN)
-IF(NOT (_LEN EQUAL 4 OR _LEN EQUAL 3))
- MESSAGE(FATAL_ERROR "Version needs to be in the form MAJOR.MINOR.RELEASE[.BUILD]")
-ENDIF()
+string(REPLACE "." " " _VERSION ${VERSION})
+separate_arguments(_VERSION)
+list(LENGTH _VERSION _LEN)
+if(NOT (_LEN EQUAL 4 OR _LEN EQUAL 3))
+ message(
+ FATAL_ERROR "Version needs to be in the form MAJOR.MINOR.RELEASE[.BUILD]")
+endif()
-LIST(GET _VERSION 0 VER_MAJOR)
-LIST(GET _VERSION 1 VER_MINOR)
-LIST(GET _VERSION 2 VER_RELEASE)
-IF(_LEN EQUAL 4)
- LIST(GET _VERSION 3 VER_BUILD)
-ELSE()
- SET(VER_BUILD 0)
-ENDIF()
+list(GET _VERSION 0 VER_MAJOR)
+list(GET _VERSION 1 VER_MINOR)
+list(GET _VERSION 2 VER_RELEASE)
+if(_LEN EQUAL 4)
+ list(GET _VERSION 3 VER_BUILD)
+else()
+ set(VER_BUILD 0)
+endif()
# where to look for cmake modules
-SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)
+set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/CMake/Modules)
-ADD_SUBDIRECTORY(src)
+add_subdirectory(src)
diff --git a/tools/dyecmd/src/CMakeLists.txt b/tools/dyecmd/src/CMakeLists.txt
index df20af69..f59eabe2 100644
--- a/tools/dyecmd/src/CMakeLists.txt
+++ b/tools/dyecmd/src/CMakeLists.txt
@@ -1,57 +1,44 @@
-FIND_PACKAGE(SDL REQUIRED)
-FIND_PACKAGE(SDL_image REQUIRED)
-FIND_PACKAGE(PNG REQUIRED)
-
-IF (CMAKE_COMPILER_IS_GNUCXX)
- # Help getting compilation warnings
- SET(CMAKE_CXX_FLAGS "-Wall")
- IF (WIN32)
- # This includes enough debug information to get something useful
- # from Dr. Mingw while keeping binary size down. Almost useless
- # with gdb, though.
- SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -ggdb0 -gstabs2")
- ENDIF()
-ENDIF()
-
-SET(FLAGS "-DPACKAGE_VERSION=\\\"${VERSION}\\\"")
-SET(FLAGS "${FLAGS} -DPKG_DATADIR=\\\"${PKG_DATADIR}/\\\"")
-SET(FLAGS "${FLAGS} -DLOCALEDIR=\\\"${LOCALEDIR}/\\\"")
-
-IF (CMAKE_BUILD_TYPE)
- STRING(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER)
- IF((CMAKE_BUILD_TYPE_TOLOWER MATCHES debug) OR
- (CMAKE_BUILD_TYPE_TOLOWER MATCHES relwithdebinfo))
- SET(FLAGS "${FLAGS} -DDEBUG")
- ENDIF()
-ENDIF()
-
-INCLUDE_DIRECTORIES(
- ${CMAKE_CURRENT_SOURCE_DIR}
- ${SDL_INCLUDE_DIR}
- ${SDLIMAGE_INCLUDE_DIR}
- ${PNG_INCLUDE_DIR}
- )
+find_package(SDL REQUIRED)
+find_package(SDL_image REQUIRED)
+find_package(PNG REQUIRED)
+
+if(CMAKE_COMPILER_IS_GNUCXX)
+ # Help getting compilation warnings
+ set(CMAKE_CXX_FLAGS "-Wall")
+ if(WIN32)
+ # This includes enough debug information to get something useful from Dr.
+ # Mingw while keeping binary size down. Almost useless with gdb, though.
+ set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -ggdb0 -gstabs2")
+ endif()
+endif()
+
+set(FLAGS "-DPACKAGE_VERSION=\\\"${VERSION}\\\"")
+set(FLAGS "${FLAGS} -DPKG_DATADIR=\\\"${PKG_DATADIR}/\\\"")
+set(FLAGS "${FLAGS} -DLOCALEDIR=\\\"${LOCALEDIR}/\\\"")
+
+if(CMAKE_BUILD_TYPE)
+ string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER)
+ if((CMAKE_BUILD_TYPE_TOLOWER MATCHES debug) OR (CMAKE_BUILD_TYPE_TOLOWER
+ MATCHES relwithdebinfo))
+ set(FLAGS "${FLAGS} -DDEBUG")
+ endif()
+endif()
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${SDL_INCLUDE_DIR}
+ ${SDLIMAGE_INCLUDE_DIR} ${PNG_INCLUDE_DIR})
# Fix some stuff that gets not hidden by mainline modules
-MARK_AS_ADVANCED(SDLIMAGE_INCLUDE_DIR)
-MARK_AS_ADVANCED(SDLIMAGE_LIBRARY)
-MARK_AS_ADVANCED(SDLMAIN_LIBRARY)
-MARK_AS_ADVANCED(SDL_INCLUDE_DIR)
-MARK_AS_ADVANCED(SDL_LIBRARY)
-
-SET(SRCS
- dye.cpp
- dye.h
- dyecmd.cpp
- imagewriter.cpp
- imagewriter.h
- )
-
-ADD_EXECUTABLE(dyecmd WIN32 ${SRCS})
-
-TARGET_LINK_LIBRARIES(dyecmd
- ${SDL_LIBRARY}
- ${SDLIMAGE_LIBRARY}
- ${PNG_LIBRARIES})
-
-SET_TARGET_PROPERTIES(dyecmd PROPERTIES COMPILE_FLAGS "${FLAGS}")
+mark_as_advanced(SDLIMAGE_INCLUDE_DIR)
+mark_as_advanced(SDLIMAGE_LIBRARY)
+mark_as_advanced(SDLMAIN_LIBRARY)
+mark_as_advanced(SDL_INCLUDE_DIR)
+mark_as_advanced(SDL_LIBRARY)
+
+set(SRCS dye.cpp dye.h dyecmd.cpp imagewriter.cpp imagewriter.h)
+
+add_executable(dyecmd WIN32 ${SRCS})
+
+target_link_libraries(dyecmd ${SDL_LIBRARY} ${SDLIMAGE_LIBRARY}
+ ${PNG_LIBRARIES})
+
+set_target_properties(dyecmd PROPERTIES COMPILE_FLAGS "${FLAGS}")