mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-03-04 17:23:33 +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)
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
find_package(PNG REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
|
||||
pkg_check_modules(ZLIB REQUIRED IMPORTED_TARGET zlib)
|
||||
pkg_check_modules(PNG REQUIRED IMPORTED_TARGET libpng16)
|
||||
|
||||
add_subdirectory(src)
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
include_directories(${ZLIB_INCLUDE_DIRS} ${PNG_INCLUDE_DIRS})
|
||||
add_definitions(${PNG_DEFINITIONS})
|
||||
add_compile_options(-std=c++11 -Wall)
|
||||
|
||||
add_executable(MinedMap
|
||||
MinedMap.cpp
|
||||
|
@ -16,16 +15,14 @@ add_executable(MinedMap
|
|||
World/Region.cpp
|
||||
World/Section.cpp
|
||||
)
|
||||
set_target_properties(MinedMap PROPERTIES COMPILE_FLAGS "-std=c++11 -Wall")
|
||||
target_link_libraries(MinedMap ${ZLIB_LIBRARIES} ${PNG_LIBRARIES})
|
||||
target_link_libraries(MinedMap PkgConfig::ZLIB PkgConfig::PNG)
|
||||
|
||||
add_executable(nbtdump
|
||||
nbtdump.cpp
|
||||
GZip.cpp
|
||||
NBT/Tag.cpp
|
||||
)
|
||||
set_target_properties(nbtdump PROPERTIES COMPILE_FLAGS "-std=c++11 -Wall")
|
||||
target_link_libraries(nbtdump ${ZLIB_LIBRARIES})
|
||||
target_link_libraries(nbtdump PkgConfig::ZLIB)
|
||||
|
||||
add_executable(regiondump
|
||||
regiondump.cpp
|
||||
|
@ -34,7 +31,6 @@ add_executable(regiondump
|
|||
World/ChunkData.cpp
|
||||
World/Region.cpp
|
||||
)
|
||||
set_target_properties(regiondump PROPERTIES COMPILE_FLAGS "-std=c++11 -Wall")
|
||||
target_link_libraries(regiondump ${ZLIB_LIBRARIES})
|
||||
target_link_libraries(regiondump PkgConfig::ZLIB)
|
||||
|
||||
install(TARGETS MinedMap RUNTIME DESTINATION bin)
|
||||
|
|
Loading…
Add table
Reference in a new issue