speed-dreams-code/cmake/internaldeps.cmake
xavi92 2cd6611844 internaldeps.cmake: Deprecate legacy macros
ADD_INTERFACE_INCLUDEDIR relied on legacy CMake macros such as
INCLUDE_DIRECTORIES. Nowadays, targets do not specify their
dependencies' include directories, but just call target_link_libraries
so that CMake takes care of the rest.

Of course, that requires every target to define their own include
directories, if any, via target_include_directories.


git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@9591 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: f1d7ea3cb16eb1a23d600b219da8c64502e10c00
Former-commit-id: f5f7e5f86e3e984e60f794115da53fb97f7a9b22
2024-10-27 07:59:26 +00:00

88 lines
3.2 KiB
CMake

############################################################################
#
# file : internaldeps.cmake
# copyright : (C) 2008 by Mart Kelder, 2010 by J.-P. Meuret
# web : www.speed-dreams.org
#
############################################################################
############################################################################
# #
# This program is free software; you can redistribute it and/or modify #
# it under the terms of the GNU General Public License as published by #
# the Free Software Foundation; either version 2 of the License, or #
# (at your option) any later version. #
# #
############################################################################
# @file Internal dependencies (include and libs)
# @author Mart Kelder, J.-P. Meuret
# SD include dirs macros.
MACRO(ADD_INTERFACE_INCLUDEDIR)
ENDMACRO(ADD_INTERFACE_INCLUDEDIR)
MACRO(ADD_SDLIB_INCLUDEDIR)
ENDMACRO(ADD_SDLIB_INCLUDEDIR)
# SD libraries macro.
MACRO(ADD_SDLIB_LIBRARY TARGET)
#MESSAGE(STATUS "ADD_SDLIB_LIBRARY : TARGET = ${TARGET}")
#MESSAGE(STATUS "ADD_SDLIB_LIBRARY : ARGN = ${ARGN}")
SET(SDLIB_OPTIONAL FALSE)
SET(SDLIB_STATIC FALSE)
SET(SDLIB_TARGET_SUFFIX "")
FOREACH(SDLIB_LIB ${ARGN})
IF(${SDLIB_LIB} STREQUAL "OPTIONAL")
SET(SDLIB_OPTIONAL TRUE)
ENDIF(${SDLIB_LIB} STREQUAL "OPTIONAL")
IF(${SDLIB_LIB} STREQUAL "STATIC")
SET(SDLIB_STATIC TRUE)
SET(SDLIB_TARGET_SUFFIX "_static")
ENDIF(${SDLIB_LIB} STREQUAL "STATIC")
ENDFOREACH(SDLIB_LIB ${ARGN})
FOREACH(SDLIB_LIB ${ARGN})
SET(SDLIB_IGNORE TRUE)
IF(NOT UNIX)
SET(SDLIB_IGNORE FALSE)
ELSEIF(NOT SDLIB_LIB STREQUAL "ssggraph" AND NOT SDLIB_LIB STREQUAL "osggraph" AND NOT SDLIB_LIB STREQUAL "track")
SET(SDLIB_IGNORE FALSE)
ENDIF(NOT UNIX)
IF(SDLIB_LIB STREQUAL "OPTIONAL" OR SDLIB_LIB STREQUAL "STATIC")
SET(SDLIB_IGNORE TRUE) #Ignore: not a real target
ENDIF(SDLIB_LIB STREQUAL "OPTIONAL" OR SDLIB_LIB STREQUAL "STATIC")
IF(SDLIB_LIB STREQUAL "txml" AND OPTION_3RDPARTY_EXPAT)
SET(SDLIB_IGNORE TRUE) #Ignore: Use Expat
ENDIF(SDLIB_LIB STREQUAL "txml" AND OPTION_3RDPARTY_EXPAT)
IF(SDLIB_LIB STREQUAL "ephemeris" OR SDLIB_LIB STREQUAL "STATIC")
SET(SDLIB_IGNORE TRUE)
ENDIF(SDLIB_LIB STREQUAL "ephemeris" OR SDLIB_LIB STREQUAL "STATIC")
IF(SDLIB_LIB STREQUAL "solid" AND OPTION_3RDPARTY_SOLID)
SET(SDLIB_IGNORE TRUE) #Ignore: Use 3rd party SOLID
ENDIF(SDLIB_LIB STREQUAL "solid" AND OPTION_3RDPARTY_SOLID)
IF(NOT SDLIB_IGNORE)
SET(SDLIB_LIBRARIES ${SDLIB_LIBRARIES} ${SDLIB_LIB}${SDLIB_TARGET_SUFFIX})
#MESSAGE(STATUS "ADD_SDLIB_LIBRARY : SDLIB_LIBRARIES = ${SDLIB_LIBRARIES}")
ENDIF(NOT SDLIB_IGNORE)
ENDFOREACH(SDLIB_LIB ${SDLIB_LIBS})
#MESSAGE(STATUS "TARGET_LINK_LIBRARIES(${TARGET} ${SDLIB_LIBRARIES})")
TARGET_LINK_LIBRARIES(${TARGET} ${SDLIB_LIBRARIES})
# FIX: most libraries require this interface library.
TARGET_LINK_LIBRARIES(${TARGET} interfaces)
ENDMACRO(ADD_SDLIB_LIBRARY TARGET)