mirror of
https://github.com/panda3d/panda3d.git
synced 2026-01-06 06:59:44 -06:00
CMake: Kill support for <2.8.12
The rationale for this is in a comment at the top of the main CMakeLists.txt file. It was getting harder to maintain support for a version this old, and pretty much no current system has CMake <3. Good riddance.
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
# We require 2.8.4 because earlier releases had a bug
|
||||
# with invalid HEADER_FILE_ONLY behavior in MSVC 2010.
|
||||
cmake_minimum_required(VERSION 2.8.4)
|
||||
# We require 2.8.12+ for three reasons:
|
||||
# 1) CMake 3 is so common these days that it's really not a burden on the user
|
||||
# to expect them to have it.
|
||||
# 2) As of this writing, this is the oldest version included in a supported
|
||||
# release of Ubuntu. Older versions are actually somewhat difficult to track
|
||||
# down, so we don't test against them.
|
||||
# 3) CMake's INTERFACE_INCLUDE_DIRECTORIES feature, which we rely on
|
||||
# extensively, finally became stable in this release.
|
||||
cmake_minimum_required(VERSION 2.8.12)
|
||||
set(CMAKE_DISABLE_SOURCE_CHANGES ON) # Must go before project() below
|
||||
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON) # Must go before project() below
|
||||
project(Panda3D)
|
||||
@@ -25,6 +31,10 @@ endif()
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/macros/")
|
||||
|
||||
# Set certain CMake flags we expect
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
# Include global modules needed for configure scripts
|
||||
include(PackageConfig) # Defines package_option AND target_use_packages
|
||||
|
||||
@@ -34,7 +44,6 @@ include(dtool/Package.cmake)
|
||||
include(dtool/Config.cmake)
|
||||
|
||||
# Include global modules
|
||||
include(AutoInclude) # Implements automatic include_directories finding
|
||||
include(AddBisonTarget) # Defines add_bison_target function
|
||||
include(AddFlexTarget) # Defines add_flex_target function
|
||||
include(CompositeSources) # Defines composite_sources function
|
||||
|
||||
@@ -167,28 +167,14 @@ function(interrogate_sources target output database module)
|
||||
endforeach(source)
|
||||
|
||||
# Interrogate also needs the include paths, so we'll extract them from the
|
||||
# target. Usually these are available via a generator expression, however
|
||||
# versions of CMake before 2.8.10 don't support the TARGET_PROPERTY genex
|
||||
# so we have to extract the property at configuration-time. Versions after
|
||||
# 2.8.11 support CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE which ONLY makes
|
||||
# this information available at generator-time (i.e. after
|
||||
# configuration-time) so the generator expression is necessary then.
|
||||
if(CMAKE_VERSION VERSION_LESS 2.8.10)
|
||||
set(include_flags)
|
||||
get_target_property(include_dirs "${target}" INTERFACE_INCLUDE_DIRECTORIES)
|
||||
foreach(include_dir ${include_dirs})
|
||||
list(APPEND include_flags "-I${include_dir}")
|
||||
endforeach(include_dir)
|
||||
# The above must also be included when compiling the resulting _igate.cxx file:
|
||||
include_directories(${include_dirs})
|
||||
else()
|
||||
# Note, the \t is a workaround for a CMake bug where using a plain space in
|
||||
# a JOIN will cause it to be escaped. Tabs are not escaped and will
|
||||
# separate correctly.
|
||||
set(include_flags "-I$<JOIN:$<TARGET_PROPERTY:${target},INTERFACE_INCLUDE_DIRECTORIES>,\t-I>")
|
||||
# The above must also be included when compiling the resulting _igate.cxx file:
|
||||
include_directories("$<TARGET_PROPERTY:${target},INTERFACE_INCLUDE_DIRECTORIES>")
|
||||
endif()
|
||||
# target. These are available via a generator expression.
|
||||
|
||||
# Note, the \t is a workaround for a CMake bug where using a plain space in
|
||||
# a JOIN will cause it to be escaped. Tabs are not escaped and will
|
||||
# separate correctly.
|
||||
set(include_flags "-I$<JOIN:$<TARGET_PROPERTY:${target},INTERFACE_INCLUDE_DIRECTORIES>,\t-I>")
|
||||
# The above must also be included when compiling the resulting _igate.cxx file:
|
||||
include_directories("$<TARGET_PROPERTY:${target},INTERFACE_INCLUDE_DIRECTORIES>")
|
||||
|
||||
# Get the compiler definition flags. These must be passed to Interrogate
|
||||
# in the same way that they are passed to the compiler so that Interrogate
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
# Filename: AutoInclude.cmake
|
||||
# Description: This file backports the CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE
|
||||
# introduced in CMake 2.8.11 to previous versions of cmake, and enables the
|
||||
# behavior by default.
|
||||
#
|
||||
|
||||
# Emulate CMake 2.8.11's CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE behavior if
|
||||
# this version doesn't define CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE.
|
||||
if(CMAKE_VERSION VERSION_LESS 2.8.11)
|
||||
# Replace some built-in functions in order to extend their functionality.
|
||||
function(add_library target)
|
||||
_add_library(${target} ${ARGN})
|
||||
set_target_properties("${target}" PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_BINARY_DIR}")
|
||||
endfunction()
|
||||
|
||||
function(add_executable target)
|
||||
_add_executable(${target} ${ARGN})
|
||||
set_target_properties("${target}" PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR};${CMAKE_CURRENT_BINARY_DIR}")
|
||||
endfunction()
|
||||
|
||||
function(target_link_libraries target)
|
||||
set(interface_dirs)
|
||||
get_target_property(target_interface_dirs "${target}" INTERFACE_INCLUDE_DIRECTORIES)
|
||||
|
||||
foreach(lib ${ARGN})
|
||||
if(TARGET "${lib}")
|
||||
get_target_property(lib_interface_dirs "${lib}" INTERFACE_INCLUDE_DIRECTORIES)
|
||||
|
||||
if(lib_interface_dirs)
|
||||
list(APPEND interface_dirs ${lib_interface_dirs})
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(interface_dirs)
|
||||
list(REMOVE_DUPLICATES interface_dirs)
|
||||
|
||||
#NB. target_include_directories is new in 2.8.8.
|
||||
#target_include_directories("${target}" ${interface_dirs})
|
||||
include_directories(${interface_dirs})
|
||||
|
||||
# Update this target's interface inc dirs.
|
||||
set_target_properties("${target}" PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${target_interface_dirs};${interface_dirs}")
|
||||
endif()
|
||||
|
||||
# Call to the built-in function we are overriding.
|
||||
_target_link_libraries(${target} ${ARGN})
|
||||
endfunction()
|
||||
|
||||
else()
|
||||
# 2.8.11 supports this natively.
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
|
||||
endif()
|
||||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
@@ -10,8 +10,6 @@
|
||||
#
|
||||
|
||||
if(CMAKE_SCRIPT_MODE_FILE)
|
||||
#cmake_minimum_required(VERSION 2.8.4)
|
||||
|
||||
if(NOT DEFINED COMPOSITE_FILE)
|
||||
message(FATAL_ERROR "COMPOSITE_FILE should be defined when running MakeComposite.cmake!")
|
||||
return()
|
||||
|
||||
@@ -144,18 +144,11 @@ set(P3EXPRESS_IGATEEXT
|
||||
|
||||
composite_sources(p3express P3EXPRESS_SOURCES)
|
||||
|
||||
add_library(p3express ${P3EXPRESS_SOURCES} ${P3EXPRESS_HEADERS})
|
||||
|
||||
# p3express needs to include from p3interrogatedb for py_panda.h and extension.h
|
||||
if(CMAKE_VERSION VERSION_LESS 2.8.11)
|
||||
get_target_property(interrogatedb_interface_dirs p3interrogatedb INTERFACE_INCLUDE_DIRECTORIES)
|
||||
include_directories(${interrogatedb_interface_dirs})
|
||||
add_library(p3express ${P3EXPRESS_SOURCES} ${P3EXPRESS_HEADERS})
|
||||
set_target_properties(p3express PROPERTIES INTERFACE_INCLUDE_DIRECTORIES
|
||||
"${interrogatedb_interface_dirs};${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
else()
|
||||
add_library(p3express ${P3EXPRESS_SOURCES} ${P3EXPRESS_HEADERS})
|
||||
target_include_directories(p3express PUBLIC
|
||||
$<TARGET_PROPERTY:p3interrogatedb,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
endif()
|
||||
target_include_directories(p3express PUBLIC
|
||||
$<TARGET_PROPERTY:p3interrogatedb,INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
target_link_libraries(p3express p3pandabase p3dtool p3prc p3dconfig)
|
||||
target_use_packages(p3express TAR ZLIB)
|
||||
target_interrogate(p3express ALL EXTENSIONS ${P3EXPRESS_IGATEEXT})
|
||||
|
||||
Reference in New Issue
Block a user