mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-03-05 17:44:52 +01:00
build: update to modern CMake, use pkg-config for zlib and libpng
Starting with CMake 3.7, we can avoid dealing with individual variables for include dirs, libraries, ... for dependencies found using pkg-config, and instead just reference them using an imported target.
This commit is contained in:
parent
5263538a29
commit
fdce587c74
2 changed files with 8 additions and 12 deletions
|
@ -1,9 +1,9 @@
|
||||||
cmake_minimum_required(VERSION 2.8.12)
|
cmake_minimum_required(VERSION 3.7)
|
||||||
project(MINEDMAP CXX)
|
project(MINEDMAP CXX)
|
||||||
|
|
||||||
|
find_package(PkgConfig REQUIRED)
|
||||||
|
|
||||||
find_package(PNG REQUIRED)
|
pkg_check_modules(ZLIB REQUIRED IMPORTED_TARGET zlib)
|
||||||
find_package(ZLIB REQUIRED)
|
pkg_check_modules(PNG REQUIRED IMPORTED_TARGET libpng16)
|
||||||
|
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
include_directories(${ZLIB_INCLUDE_DIRS} ${PNG_INCLUDE_DIRS})
|
add_compile_options(-std=c++11 -Wall)
|
||||||
add_definitions(${PNG_DEFINITIONS})
|
|
||||||
|
|
||||||
add_executable(MinedMap
|
add_executable(MinedMap
|
||||||
MinedMap.cpp
|
MinedMap.cpp
|
||||||
|
@ -16,16 +15,14 @@ add_executable(MinedMap
|
||||||
World/Region.cpp
|
World/Region.cpp
|
||||||
World/Section.cpp
|
World/Section.cpp
|
||||||
)
|
)
|
||||||
set_target_properties(MinedMap PROPERTIES COMPILE_FLAGS "-std=c++11 -Wall")
|
target_link_libraries(MinedMap PkgConfig::ZLIB PkgConfig::PNG)
|
||||||
target_link_libraries(MinedMap ${ZLIB_LIBRARIES} ${PNG_LIBRARIES})
|
|
||||||
|
|
||||||
add_executable(nbtdump
|
add_executable(nbtdump
|
||||||
nbtdump.cpp
|
nbtdump.cpp
|
||||||
GZip.cpp
|
GZip.cpp
|
||||||
NBT/Tag.cpp
|
NBT/Tag.cpp
|
||||||
)
|
)
|
||||||
set_target_properties(nbtdump PROPERTIES COMPILE_FLAGS "-std=c++11 -Wall")
|
target_link_libraries(nbtdump PkgConfig::ZLIB)
|
||||||
target_link_libraries(nbtdump ${ZLIB_LIBRARIES})
|
|
||||||
|
|
||||||
add_executable(regiondump
|
add_executable(regiondump
|
||||||
regiondump.cpp
|
regiondump.cpp
|
||||||
|
@ -34,7 +31,6 @@ add_executable(regiondump
|
||||||
World/ChunkData.cpp
|
World/ChunkData.cpp
|
||||||
World/Region.cpp
|
World/Region.cpp
|
||||||
)
|
)
|
||||||
set_target_properties(regiondump PROPERTIES COMPILE_FLAGS "-std=c++11 -Wall")
|
target_link_libraries(regiondump PkgConfig::ZLIB)
|
||||||
target_link_libraries(regiondump ${ZLIB_LIBRARIES})
|
|
||||||
|
|
||||||
install(TARGETS MinedMap RUNTIME DESTINATION bin)
|
install(TARGETS MinedMap RUNTIME DESTINATION bin)
|
||||||
|
|
Loading…
Add table
Reference in a new issue