speed-dreams-code/cmake/macros.cmake
torcs-ng b63d4269af remove message file install in macro.cmake
git-svn-id: https://svn.code.sf.net/p/speed-dreams/code/trunk@2659 30fe4595-0a0c-4342-8851-515496e4dcbd

Former-commit-id: 114b3ddfe2972aee7e822898136750d3272820f6
Former-commit-id: 6208c48dd5e5c93ad8c31ae846b8927a13d13fc4
2010-08-14 21:19:06 +00:00

1106 lines
44 KiB
CMake

IF(NOT DEFINED IN_SOURCETREE)
SET(IN_SOURCETREE TRUE)
ENDIF(NOT DEFINED IN_SOURCETREE)
IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
IF(WIN32)
SET(CMAKE_INSTALL_PREFIX "C:/Program files/speed-dreams-dev" CACHE PATH "Prefix prepended to install directories" FORCE)
ELSE()
SET(CMAKE_INSTALL_PREFIX "/usr/local/dev" CACHE PATH "Prefix prepended to install directories" FORCE)
ENDIF()
ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
IF(NOT SOURCE_DIR AND IN_SOURCETREE)
FIND_PATH(SOURCE_CMAKE_PATH cmake/macros.cmake PATHS . .. ../.. ../../.. ../../../.. ../../../../.. ../../../../../.. ../../../../../../.. ../../../../../../../.. ${CMAKE_SOURCE_DIR} NO_DEFAULT_PATH)
FIND_PATH(SOURCE_CMAKE_PATH cmake/macros.cmake PATHS . .. ../.. ../../.. ../../../.. ../../../../.. ../../../../../.. ../../../../../../.. ../../../../../../../.. ${CMAKE_SOURCE_DIR})
GET_FILENAME_COMPONENT(SOURCE_DIR ${SOURCE_CMAKE_PATH} ABSOLUTE CACHE)
SET(SOURCE_CMAKE_PATH "")
ENDIF(NOT SOURCE_DIR AND IN_SOURCETREE)
GET_FILENAME_COMPONENT(CURRENT_LIST_FILE_PATH ${CMAKE_CURRENT_LIST_FILE} PATH)
INCLUDE(${CURRENT_LIST_FILE_PATH}/split_argn.cmake)
IF(IN_SOURCETREE)
FIND_PATH(CONFIGH_INCLUDE_DIR config.h PATHS ${SOURCE_DIR} ${CMAKE_BINARY_DIR} NO_DEFAULT_PATH)
FIND_PATH(CONFIGH_INCLUDE_DIR config.h PATHS ${SOURCE_DIR} ${CMAKE_BINARY_DIR})
IF(CONFIGH_INCLUDE_DIR)
SET(HAVE_CONFIG_H TRUE)
ELSE(CONFIGH_INCLUDE_DIR)
SET(HAVE_CONFIG_H FALSE)
ENDIF(CONFIGH_INCLUDE_DIR)
ELSE(IN_SOURCETREE)
SET(HAVE_CONFIG_H FALSE)
ENDIF(IN_SOURCETREE)
IF(WIN32)
SET(TORCS_LOCALDIR "~/speed-dreams-dev.settings" CACHE DOC "Where the user settings files should go")
ELSE(WIN32) #UNIX
SET(TORCS_LOCALDIR "~/.speed-dreams-dev" CACHE DOC "Where the user settings files should go")
ENDIF(WIN32)
IF(IN_SOURCETREE)
SET(TORCS_BINDIR bin CACHE PATH "Place where the executables should go")
IF(WIN32)
SET(TORCS_DATADIR share CACHE PATH "Place where all the data should go")
SET(TORCS_LIBDIR lib CACHE PATH "Place where the libraries should go")
SET(TORCS_INCLUDEDIR include CACHE PATH "Place where the include files should go")
ELSE(WIN32) #UNIX
SET(TORCS_DATADIR share/games/speed-dreams CACHE PATH "Place where all the data should go")
SET(TORCS_LIBDIR lib/speed-dreams CACHE PATH "Place where the libraries should go")
SET(TORCS_INCLUDEDIR include/speed-dreams CACHE PATH "Place where the include files should go")
ENDIF(WIN32)
ELSE(IN_SOURCETREE)
SET(TORCS_DATADIR ${TORCS_DATADIR_ABS})
SET(TORCS_LIBDIR ${TORCS_LIBDIR_ABS})
SET(TORCS_BINDIR ${TORCS_BINDIR_ABS})
SET(TORCS_INCLUDEDIR ${TORCS_INCLUDEDIR_ABS})
ENDIF(IN_SOURCETREE)
IF(IS_ABSOLUTE ${TORCS_DATADIR})
GET_FILENAME_COMPONENT(TORCS_DATADIR_ABS ${TORCS_DATADIR} ABSOLUTE)
ELSE(IS_ABSOLUTE ${TORCS_DATADIR})
GET_FILENAME_COMPONENT(TORCS_DATADIR_ABS ${CMAKE_INSTALL_PREFIX}/${TORCS_DATADIR} ABSOLUTE)
ENDIF(IS_ABSOLUTE ${TORCS_DATADIR})
IF(IS_ABSOLUTE ${TORCS_LIBDIR})
GET_FILENAME_COMPONENT(TORCS_LIBDIR_ABS ${TORCS_LIBDIR} ABSOLUTE)
ELSE(IS_ABSOLUTE ${TORCS_LIBDIR})
GET_FILENAME_COMPONENT(TORCS_LIBDIR_ABS ${CMAKE_INSTALL_PREFIX}/${TORCS_LIBDIR} ABSOLUTE)
ENDIF(IS_ABSOLUTE ${TORCS_LIBDIR})
IF(IS_ABSOLUTE ${TORCS_BINDIR})
GET_FILENAME_COMPONENT(TORCS_BINDIR_ABS ${TORCS_BINDIR} ABSOLUTE)
ELSE(IS_ABSOLUTE ${TORCS_BINDIR})
GET_FILENAME_COMPONENT(TORCS_BINDIR_ABS ${CMAKE_INSTALL_PREFIX}/${TORCS_BINDIR} ABSOLUTE)
ENDIF(IS_ABSOLUTE ${TORCS_BINDIR})
IF(IS_ABSOLUTE ${TORCS_INCLUDEDIR})
GET_FILENAME_COMPONENT(TORCS_INCLUDEDIR_ABS ${TORCS_INCLUDEDIR} ABSOLUTE)
ELSE(IS_ABSOLUTE ${TORCS_INCLUDEDIR})
GET_FILENAME_COMPONENT(TORCS_INCLUDEDIR_ABS ${CMAKE_INSTALL_PREFIX}/${TORCS_INCLUDEDIR} ABSOLUTE)
ENDIF(IS_ABSOLUTE ${TORCS_INCLUDEDIR})
STRING(REGEX REPLACE "^(.*[^/])/*$" "\\1" TORCS_LOCALDIR_TMP ${TORCS_LOCALDIR})
SET(TORCS_LOCALDIR ${TORCS_LOCALDIR_TMP})
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CURRENT_LIST_FILE_PATH})
SET(CMAKE_INSTALL_RPATH "${TORCS_LIBDIR_ABS}/lib")
# Robot .def file generation for Windows
# ROBOTNAME : Name of the robot
# DEF_FILE : Target .def file path-name
# Other args : Robot DLL Interface description, as a list of names of exported symbols,
# but with keywords shortcuts :
# - if empty, assumed keyword "LEGACY_MIN"
# - if "LEGACY_MIN", means the smallest legacy scheme interface (TORCS style)
# with only "${NAME}" exported
# - if "LEGACY", means the complete legacy scheme interface,
# with "${NAME}" and "${NAME}Shut" exported
# - if "WELCOME", means the complete new scheme interface (Speed Dreams style),
# with "moduleWelcome", "moduleInitialize" and "moduleTerminate"
# exported
# - may be a list of above keywords for multi-scheme interface
# - may also be the raw list of symbols to export
MACRO(GENERATE_ROBOT_DEF_FILE ROBOTNAME DEF_FILE)
# Build the real list of exported symbols from the given one (that may include shortcuts)
#MESSAGE(STATUS "Generating ${DEF_FILE} for ${ROBOTNAME} robot")
SET(SYMBOLS) # Initialize the list
FOREACH(KEYSYM ${ARGN})
IF(KEYSYM STREQUAL "LEGACY_MIN")
LIST(APPEND SYMBOLS ${ROBOTNAME})
ELSEIF(KEYSYM STREQUAL "LEGACY")
LIST(APPEND SYMBOLS ${ROBOTNAME})
LIST(APPEND SYMBOLS "${ROBOTNAME}Shut")
ELSEIF(KEYSYM STREQUAL "WELCOME")
LIST(APPEND SYMBOLS moduleWelcome moduleInitialize moduleTerminate)
ELSE(KEYSYM STREQUAL "LEGACY_MIN")
LIST(APPEND SYMBOLS ${KEYSYM})
ENDIF(KEYSYM STREQUAL "LEGACY_MIN")
ENDFOREACH(KEYSYM ${ARGN})
# Clean duplicates
LIST(REMOVE_DUPLICATES SYMBOLS)
#MESSAGE(STATUS "Symbols: ${SYMBOLS}")
# Build an acceptable string for the .def file from this symbol list
SET(ROBOTSYMBOLS "")
FOREACH(SYMBOL ${SYMBOLS})
SET(ROBOTSYMBOLS "${ROBOTSYMBOLS}\n\t${SYMBOL}")
ENDFOREACH(SYMBOL ${SYMBOLS})
# Generate the .def file
IF(IN_SOURCETREE)
CONFIGURE_FILE(${SOURCE_DIR}/cmake/robot_def.cmake ${DEF_FILE})
ELSE(IN_SOURCETREE)
CONFIGURE_FILE(${TORCS_DATADIR_ABS}/cmake/robot_def.cmake ${DEF_FILE})
ENDIF(IN_SOURCETREE)
ENDMACRO(GENERATE_ROBOT_DEF_FILE ROBOTNAME DEF_FILE)
# Robot project definition (module build and install, without associated data)
# Args:
# NAME : Name of the robot
# INTERFACE : Robot Windows DLL Interface description (tells about exported symbols)
# See GENERATE_ROBOT_DEF_FILE macro.
# If not specified, defaults to "LEGACY_MIN" ; not used if MODULE used
# SOURCES : List of files to use as build sources if any ; not needed if MODULE used
# CLONENAMES : The names of the clones to generate
MACRO(ROBOT_MODULE)
SET(ROBOT_SYNTAX "NAME,1,1,HAS_ROBOTNAME,ROBOTNAME")
SET(ROBOT_SYNTAX ${ROBOT_SYNTAX} "INTERFACE,0,-1,HAS_INTERFACE,INTERFACE")
SET(ROBOT_SYNTAX ${ROBOT_SYNTAX} "SOURCES,0,-1,HAS_SOURCES,SOURCES")
SET(ROBOT_SYNTAX ${ROBOT_SYNTAX} "CLONENAMES,0,-1,HAS_CLONENAMES,CLONENAMES")
SPLIT_ARGN(${ROBOT_SYNTAX} ARGUMENTS ${ARGN})
IF(NOT HAS_ROBOTNAME)
MESSAGE(FATAL_ERROR "Cannot build a robot module with no specified name")
ENDIF(NOT HAS_ROBOTNAME)
IF(NOT HAS_SOURCES)
MESSAGE(FATAL_ERROR "Cannot build a robot module without sources / module to copy")
ENDIF(NOT HAS_SOURCES)
PROJECT("robot_${ROBOTNAME}")
ADD_INTERFACE_INCLUDEDIR()
ADD_OSSPEC_INCLUDEDIR()
ADD_TORCSLIB_INCLUDEDIR(learning math portability robottools tgf)
ADD_PLIB_INCLUDEDIR()
# Generate / add .def file for Windows
IF(WIN32)
IF(NOT HAS_INTERFACE)
SET(INTERFACE "LEGACY_MIN")
ENDIF(NOT HAS_INTERFACE)
SET(ROBOT_DEF_FILE ${CMAKE_CURRENT_BINARY_DIR}/${ROBOTNAME}_gen.def)
GENERATE_ROBOT_DEF_FILE(${ROBOTNAME} ${ROBOT_DEF_FILE} ${INTERFACE})
SET(SOURCES ${SOURCES} ${ROBOT_DEF_FILE})
ENDIF(WIN32)
#disable developer warning
if (COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)
ADD_LIBRARY(${ROBOTNAME} SHARED ${SOURCES})
IF(UNIX)
SET_TARGET_PROPERTIES(${ROBOTNAME} PROPERTIES PREFIX "")
ENDIF(UNIX)
ADD_PLIB_LIBRARY(${ROBOTNAME} sg ssg)
ADD_TORCSLIB_LIBRARY(${ROBOTNAME} robottools)
TORCS_INSTALL_FILES(LIB drivers/${ROBOTNAME} TARGETS ${ROBOTNAME})
IF(HAS_CLONENAMES)
GET_TARGET_PROPERTY(MODNAME ${ROBOTNAME} LOCATION)
SET(MODPREFIX "")
SET(MODSUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX})
FOREACH(CLONENAME ${CLONENAMES})
SET(CLONE_MODNAME ${MODPREFIX}${CLONENAME}${MODSUFFIX})
ADD_CUSTOM_COMMAND(TARGET ${ROBOTNAME} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${MODNAME} ${CLONE_MODNAME})
TORCS_INSTALL_FILES(LIB drivers/${CLONENAME} FILES ${CLONE_MODNAME})
ENDFOREACH(CLONENAME ${CLONENAMES})
ENDIF(HAS_CLONENAMES)
ENDMACRO(ROBOT_MODULE)
# Robot data installation
# Args:
# NAME : Name of the robot (may be a clone)
# SHIPPREFIX : Dir. prefix for source files/subdirs to install in the robot's data dir
# SHIPFILES : Extra (non default) files to install in the robot's data dir
# SHIPSUBDIRS : Data subdirectories to install in the robot's data dir
MACRO(ROBOT_DATA)
SET(ROBOT_SYNTAX "NAME,1,1,HAS_ROBOTNAME,ROBOTNAME")
SET(ROBOT_SYNTAX ${ROBOT_SYNTAX} "SHIPPREFIX,0,-1,HAS_SHIPPREFIX,SHIPPREFIX")
SET(ROBOT_SYNTAX ${ROBOT_SYNTAX} "SHIPFILES,0,-1,HAS_EXTRA_SHIP,EXTRA_SHIP")
SET(ROBOT_SYNTAX ${ROBOT_SYNTAX} "SHIPSUBDIRS,0,-1,HAS_SHIPSUBDIRS,SHIPSUBDIRS")
SPLIT_ARGN(${ROBOT_SYNTAX} ARGUMENTS ${ARGN})
IF(NOT HAS_ROBOTNAME)
MESSAGE(FATAL_ERROR "Cannot install data for a robot module with no specified name")
ENDIF(NOT HAS_ROBOTNAME)
SET(REAL_SHIPFILES) # Reset the list (remember, it's a CMakeLists.txt global variable :-()
IF(HAS_EXTRA_SHIP)
IF(HAS_SHIPPREFIX)
FOREACH(SHIP_FILE ${EXTRA_SHIP})
LIST(APPEND REAL_SHIPFILES ${SHIPPREFIX}/${SHIP_FILE})
ENDFOREACH(SHIP_FILE ${EXTRA_SHIP})
ELSE(HAS_SHIPPREFIX)
SET(REAL_SHIPFILES ${EXTRA_SHIP})
ENDIF(HAS_SHIPPREFIX)
ENDIF(HAS_EXTRA_SHIP)
IF(HAS_SHIPPREFIX)
LIST(APPEND REAL_SHIPFILES ${SHIPPREFIX}/${ROBOTNAME}.xml)
ELSE(HAS_SHIPPREFIX)
LIST(APPEND REAL_SHIPFILES ${ROBOTNAME}.xml)
ENDIF(HAS_SHIPPREFIX)
#MESSAGE(STATUS "Files to install for ${ROBOTNAME} robot: ${REAL_SHIPFILES}")
TORCS_INSTALL_FILES(DATA drivers/${ROBOTNAME} FILES ${REAL_SHIPFILES})
IF(HAS_SHIPSUBDIRS)
IF(HAS_SHIPPREFIX)
SET(REAL_SHIPSUBDIRS) # Reset the list (remember, it's a CMakeLists.txt global variable :-()
FOREACH(SHIPSUBDIR ${SHIPSUBDIRS})
LIST(APPEND REAL_SHIPSUBDIRS ${SHIPPREFIX}/${SHIPSUBDIR})
ENDFOREACH(SHIPSUBDIR ${SHIPSUBDIRS})
ELSE(HAS_SHIPPREFIX)
SET(REAL_SHIPSUBDIRS ${SHIPSUBDIRS})
ENDIF(HAS_SHIPPREFIX)
#MESSAGE(STATUS "Subdirs to install for ${ROBOTNAME} robot: ${REAL_SHIPSUBDIRS}")
INSTALL(DIRECTORY ${REAL_SHIPSUBDIRS}
DESTINATION ${TORCS_DATADIR}/drivers/${ROBOTNAME}
REGEX "/\\.svn$" EXCLUDE
REGEX "/Makefile$" EXCLUDE
REGEX "/\\.xcf$" EXCLUDE
REGEX "/\\.xcf.bz2$" EXCLUDE)
ENDIF(HAS_SHIPSUBDIRS)
ENDMACRO(ROBOT_DATA)
# Robot project definition (module build and install, with associated data)
# Args:
# NAME : Name of the robot
# INTERFACE : Robot Windows DLL Interface description (tells about exported symbols)
# See GENERATE_ROBOT_DEF_FILE macro.
# If not specified, defaults to "LEGACY_MIN" ; not used if MODULE used
# SOURCES : List of files to use as build sources if any ; not needed if MODULE used
# SHIPPREFIX : Dir. prefix for source files/subdirs to install in the robot's data dir
# SHIPFILES : Extra (non default) files to install in the robot's data dir
# SHIPSUBDIRS : Data subdirectories to install in the robot's data dir
MACRO(ROBOT)
SET(ROBOT_SYNTAX "NAME,1,1,HAS_ROBOTNAME,ROBOTNAME")
SET(ROBOT_SYNTAX ${ROBOT_SYNTAX} "INTERFACE,0,-1,HAS_INTERFACE,INTERFACE")
SET(ROBOT_SYNTAX ${ROBOT_SYNTAX} "SOURCES,0,-1,HAS_SOURCES,SOURCES")
SET(ROBOT_SYNTAX ${ROBOT_SYNTAX} "SHIPPREFIX,0,-1,HAS_SHIPPREFIX,SHIPPREFIX")
SET(ROBOT_SYNTAX ${ROBOT_SYNTAX} "SHIP,0,-1,HAS_EXTRA_SHIP,EXTRA_SHIP")
SET(ROBOT_SYNTAX ${ROBOT_SYNTAX} "SHIPSUBDIRS,0,-1,HAS_SHIPSUBDIRS,SHIPSUBDIRS")
SPLIT_ARGN(${ROBOT_SYNTAX} ARGUMENTS ${ARGN})
IF(NOT HAS_ROBOTNAME)
MESSAGE(FATAL_ERROR "Cannot build a robot with no specified name")
ENDIF(NOT HAS_ROBOTNAME)
IF(NOT HAS_SOURCES)
MESSAGE(FATAL_ERROR "Cannot build a robot without sources")
ENDIF(NOT HAS_SOURCES)
IF(HAS_INTERFACE)
ROBOT_MODULE(NAME ${ROBOTNAME} INTERFACE ${INTERFACE} SOURCES ${SOURCES})
ELSE(HAS_INTERFACE)
ROBOT_MODULE(NAME ${ROBOTNAME} SOURCES ${SOURCES})
ENDIF(HAS_INTERFACE)
IF(HAS_SHIPPREFIX)
IF(HAS_EXTRA_SHIP)
IF(HAS_SHIPSUBDIRS)
ROBOT_DATA(NAME ${ROBOTNAME} SHIPPREFIX ${SHIPPREFIX}
SHIPFILES ${EXTRA_SHIP} SHIPSUBDIRS ${SHIPSUBDIRS})
ELSE(HAS_SHIPSUBDIRS)
ROBOT_DATA(NAME ${ROBOTNAME} SHIPPREFIX ${SHIPPREFIX}
SHIPFILES ${EXTRA_SHIP})
ENDIF(HAS_SHIPSUBDIRS)
ELSE(HAS_EXTRA_SHIP)
IF(HAS_SHIPSUBDIRS)
ROBOT_DATA(NAME ${ROBOTNAME} SHIPPREFIX ${SHIPPREFIX}
SHIPSUBDIRS ${SHIPSUBDIRS})
ELSE(HAS_SHIPSUBDIRS)
ROBOT_DATA(NAME ${ROBOTNAME} SHIPPREFIX ${SHIPPREFIX})
ENDIF(HAS_SHIPSUBDIRS)
ENDIF(HAS_EXTRA_SHIP)
ELSE(HAS_SHIPPREFIX)
IF(HAS_EXTRA_SHIP)
IF(HAS_SHIPSUBDIRS)
ROBOT_DATA(NAME ${ROBOTNAME}
SHIPFILES ${EXTRA_SHIP} SHIPSUBDIRS ${SHIPSUBDIRS})
ELSE(HAS_SHIPSUBDIRS)
ROBOT_DATA(NAME ${ROBOTNAME}
SHIPFILES ${EXTRA_SHIP})
ENDIF(HAS_SHIPSUBDIRS)
ELSE(HAS_EXTRA_SHIP)
IF(HAS_SHIPSUBDIRS)
ROBOT_DATA(NAME ${ROBOTNAME}
SHIPSUBDIRS ${SHIPSUBDIRS})
ELSE(HAS_SHIPSUBDIRS)
ROBOT_DATA(NAME ${ROBOTNAME})
ENDIF(HAS_SHIPSUBDIRS)
ENDIF(HAS_EXTRA_SHIP)
ENDIF(HAS_SHIPPREFIX)
ENDMACRO(ROBOT)
MACRO(ADD_INTERFACE_INCLUDEDIR)
IF(IN_SOURCETREE)
SET(INCLUDE_CANDIDATE ${SOURCE_DIR}/src/interfaces)
ELSE(IN_SOURCETREE)
SET(INCLUDE_CANDIDATE ${TORCS_INCLUDEDIR_ABS})
ENDIF(IN_SOURCETREE)
FIND_PATH(INTERFACE_INCLUDE_DIR raceman.h PATHS ${INCLUDE_CANDIDATE} /usr/include /usr/local/include NO_DEFAULT_PATH)
FIND_PATH(INTERFACE_INCLUDE_DIR raceman.h PATHS ${INCLUDE_CANDIDATE} /usr/include /usr/local/include)
IF(INTERFACE_INCLUDE_DIR)
INCLUDE_DIRECTORIES(${INTERFACE_INCLUDE_DIR})
ELSE(INTERFACE_INCLUDE_DIR)
MESSAGE(FATAL_ERROR "Cannot find interface header files")
ENDIF(INTERFACE_INCLUDE_DIR)
ENDMACRO(ADD_INTERFACE_INCLUDEDIR)
MACRO(ADD_OSSPEC_INCLUDEDIR)
IF(IN_SOURCETREE)
IF(UNIX)
SET(CANDIDATE_SPEC ${SOURCE_DIR}/src/linux)
ELSEIF(WIN32)
SET(CANDIDATE_SPEC ${SOURCE_DIR}/src/windows)
ELSE(UNIX)
SET(CANDIDATE_SPEC ${SOURCE_DIR})
ENDIF(UNIX)
ELSE(IN_SOURCETREE)
SET(CANDIDATE_SPEC ${TORCS_INCLUDEDIR})
ENDIF(IN_SOURCETREE)
FIND_PATH(OSSPEC_INCLUDE_DIR osspec.h PATHS ${CANDIDATE_SPEC} /usr/include /usr/local/include NO_DEFAULT_PATH CACHE DOC "osspec header directory")
FIND_PATH(OSSPEC_INCLUDE_DIR osspec.h PATHS ${CANDIDATE_SPEC} /usr/include /usr/local/include CACHE DOC "osspec header directory")
IF(OSSPEC_INCLUDE_DIR)
INCLUDE_DIRECTORIES(${OSSPEC_INCLUDE_DIR})
ELSE(OSSPEC_INCLUDE_DIR)
MESSAGE(FATAL_ERROR "Cannot find osspec header file")
ENDIF(OSSPEC_INCLUDE_DIR)
ENDMACRO(ADD_OSSPEC_INCLUDEDIR)
MACRO(ADD_TORCSLIB_INCLUDEDIR)
SET(TORCSLIB_OPTIONAL FALSE)
FOREACH(TORCSLIB_LIB ${ARGN})
IF(${TORCSLIB_LIB} STREQUAL "OPTIONAL")
SET(TORCSLIB_OPTIONAL TRUE)
ENDIF(${TORCSLIB_LIB} STREQUAL "OPTIONAL")
ENDFOREACH(TORCSLIB_LIB ${ARGN})
FOREACH(TORCSLIB_LIB ${ARGN})
SET(TORCSLIB_FOUND_LIB TRUE)
SET(TORCSLIB_EXTRA_INCLUDEDIR "")
IF(TORCSLIB_LIB STREQUAL "client")
IF(IN_SOURCETREE)
SET(INCLUDE_CANDIDATE ${SOURCE_DIR}/src/libs/client)
ELSE(IN_SOURCETREE)
SET(INCLUDE_CANDIDATE ${TORCS_INCLUDEDIR_ABS})
ENDIF(IN_SOURCETREE)
FIND_PATH(TORCSLIB_CLIENT_INCLUDE_DIR client.h PATHS ${INCLUDE_CANDIDATE} /usr/include /usr/local/include NO_DEFAULT_PATH)
FIND_PATH(TORCSLIB_CLIENT_INCLUDE_DIR client.h PATHS ${INCLUDE_CANDIDATE} /usr/include /usr/local/include)
SET(TORCSLIB_EXTRA_INCLUDEDIR TORCSLIB_CLIENT_INCLUDE_DIR)
ELSEIF(TORCSLIB_LIB STREQUAL "confscreens")
IF(IN_SOURCETREE)
SET(INCLUDE_CANDIDATE ${SOURCE_DIR}/src/libs/confscreens)
ELSE(IN_SOURCETREE)
SET(INCLUDE_CANDIDATE ${TORCS_INCLUDEDIR_ABS})
ENDIF(IN_SOURCETREE)
FIND_PATH(TORCSLIB_CONFSCREENS_INCLUDE_DIR confscreens.h PATHS ${INCLUDE_CANDIDATE} /usr/include /usr/local/include NO_DEFAULT_PATH)
FIND_PATH(TORCSLIB_CONFSCREENS_INCLUDE_DIR confscreens.h PATHS ${INCLUDE_CANDIDATE} /usr/include /usr/local/include)
SET(TORCSLIB_EXTRA_INCLUDEDIR TORCSLIB_CONFSCREENS_INCLUDE_DIR)
ELSEIF(TORCSLIB_LIB STREQUAL "learning")
IF(IN_SOURCETREE)
SET(INCLUDE_CANDIDATE ${SOURCE_DIR}/src/libs/learning)
ELSE(IN_SOURCETREE)
SET(INCLUDE_CANDIDATE ${TORCS_INCLUDEDIR_ABS})
ENDIF(IN_SOURCETREE)
FIND_PATH(TORCSLIB_LEARNING_INCLUDE_DIR learn_debug.h PATHS ${INCLUDE_CANDIDATE} /usr/include /usr/local/include PATH_SUFFIXES "" learning NO_DEFAULT_PATH)
FIND_PATH(TORCSLIB_LEARNING_INCLUDE_DIR learn_debug.h PATHS ${INCLUDE_CANDIDATE} /usr/include /usr/local/include PATH_SUFFIXES "" learning)
SET(TORCSLIB_EXTRA_INCLUDEDIR TORCSLIB_LEARNING_INCLUDE_DIR)
ELSEIF(TORCSLIB_LIB STREQUAL "math")
IF(IN_SOURCETREE)
SET(INCLUDE_CANDIDATE ${SOURCE_DIR}/src/libs/math)
ELSE(IN_SOURCETREE)
SET(INCLUDE_CANDIDATE ${TORCS_INCLUDEDIR_ABS})
ENDIF(IN_SOURCETREE)
FIND_PATH(TORCSLIB_MATH_INCLUDE_DIR linalg_t.h PATHS ${INCLUDE_CANDIDATE} /usr/include /usr/local/include PATH_SUFFIXES "" math tmath NO_DEFAULT_PATH)
FIND_PATH(TORCSLIB_MATH_INCLUDE_DIR linalg_t.h PATHS ${INCLUDE_CANDIDATE} /usr/include /usr/local/include PATH_SUFFIXES "" math tmath)
SET(TORCSLIB_EXTRA_INCLUDEDIR TORCSLIB_MATH_INCLUDE_DIR)
ELSEIF(TORCSLIB_LIB STREQUAL "networking")
IF(IN_SOURCETREE)
SET(INCLUDE_CANDIDATE ${SOURCE_DIR}/src/modules/networking)
ELSE(IN_SOURCETREE)
SET(INCLUDE_CANDIDATE ${TORCS_INCLUDEDIR_ABS})
ENDIF(IN_SOURCETREE)
FIND_PATH(TORCSLIB_NETWORKING_INCLUDE_DIR network.h PATHS ${INCLUDE_CANDIDATE} /usr/include /usr/local/include NO_DEFAULT_PATH)
FIND_PATH(TORCSLIB_NETWORKING_INCLUDE_DIR network.h PATHS ${INCLUDE_CANDIDATE} /usr/include /usr/local/include)
SET(TORCSLIB_EXTRA_INCLUDEDIR TORCSLIB_NETWORKING_INCLUDE_DIR)
ELSEIF(TORCSLIB_LIB STREQUAL "portability")
IF(IN_SOURCETREE)
SET(INCLUDE_CANDIDATE ${SOURCE_DIR}/src/libs/portability)
ELSE(IN_SOURCETREE)
SET(INCLUDE_CANDIDATE ${TORCS_INCLUDEDIR_ABS})
ENDIF(IN_SOURCETREE)
FIND_PATH(TORCSLIB_PORTABILITY_INCLUDE_DIR portability.h PATHS ${INCLUDE_CANDIDATE} /usr/include /usr/local/include NO_DEFAULT_PATH)
FIND_PATH(TORCSLIB_PORTABILITY_INCLUDE_DIR portability.h PATHS ${INCLUDE_CANDIDATE} /usr/include /usr/local/include)
SET(TORCSLIB_EXTRA_INCLUDEDIR TORCSLIB_PORTABILITY_INCLUDE_DIR)
ELSEIF(TORCSLIB_LIB STREQUAL "raceengineclient")
IF(IN_SOURCETREE)
SET(INCLUDE_CANDIDATE ${SOURCE_DIR}/src/libs/raceengineclient)
ELSE(IN_SOURCETREE)
SET(INCLUDE_CANDIDATE ${TORCS_INCLUDEDIR_ABS})
ENDIF(IN_SOURCETREE)
FIND_PATH(TORCSLIB_RACEENGINECLIENT_INCLUDE_DIR raceengine.h PATHS ${INCLUDE_CANDIDATE} /usr/include /usr/local/include NO_DEFAULT_PATH)
FIND_PATH(TORCSLIB_RACEENGINECLIENT_INCLUDE_DIR raceengine.h PATHS ${INCLUDE_CANDIDATE} /usr/include /usr/local/include)
SET(TORCSLIB_EXTRA_INCLUDEDIR TORCSLIB_RACEENGINECLIENT_INCLUDE_DIR)
ELSEIF(TORCSLIB_LIB STREQUAL "racescreens")
IF(IN_SOURCETREE)
SET(INCLUDE_CANDIDATE ${SOURCE_DIR}/src/libs/racescreens)
ELSE(IN_SOURCETREE)
SET(INCLUDE_CANDIDATE ${TORCS_INCLUDEDIR_ABS})
ENDIF(IN_SOURCETREE)
FIND_PATH(TORCSLIB_RACESCREENS_INCLUDE_DIR racescreens.h PATHS ${INCLUDE_CANDIDATE} /usr/include /usr/local/include NO_DEFAULT_PATH)
FIND_PATH(TORCSLIB_RACESCREENS_INCLUDE_DIR racescreens.h PATHS ${INCLUDE_CANDIDATE} /usr/include /usr/local/include)
SET(TORCSLIB_EXTRA_INCLUDEDIR TORCSLIB_RACESCREENS_INCLUDE_DIR)
ELSEIF(TORCSLIB_LIB STREQUAL "robottools")
IF(IN_SOURCETREE)
SET(INCLUDE_CANDIDATE ${SOURCE_DIR}/src/libs/robottools)
ELSE(IN_SOURCETREE)
SET(INCLUDE_CANDIDATE ${TORCS_INCLUDEDIR_ABS})
ENDIF(IN_SOURCETREE)
FIND_PATH(TORCSLIB_ROBOTTOOLS_INCLUDE_DIR robottools.h PATHS ${INCLUDE_CANDIDATE} /usr/include /usr/local/include NO_DEFAULT_PATH)
FIND_PATH(TORCSLIB_ROBOTTOOLS_INCLUDE_DIR robottools.h PATHS ${INCLUDE_CANDIDATE} /usr/include /usr/local/include)
SET(TORCSLIB_EXTRA_INCLUDEDIR TORCSLIB_ROBOTTOOLS_INCLUDE_DIR)
ELSEIF(TORCSLIB_LIB STREQUAL "tgf")
IF(IN_SOURCETREE)
SET(INCLUDE_CANDIDATE ${SOURCE_DIR}/src/libs/tgf)
ELSE(IN_SOURCETREE)
SET(INCLUDE_CANDIDATE ${TORCS_INCLUDEDIR_ABS})
ENDIF(IN_SOURCETREE)
FIND_PATH(TORCSLIB_TGF_INCLUDE_DIR tgf.h PATHS ${INCLUDE_CANDIDATE} /usr/include /usr/local/include NO_DEFAULT_PATH)
FIND_PATH(TORCSLIB_TGF_INCLUDE_DIR tgf.h PATHS ${INCLUDE_CANDIDATE} /usr/include /usr/local/include)
SET(TORCSLIB_EXTRA_INCLUDEDIR TORCSLIB_TGF_INCLUDE_DIR)
ELSEIF(TORCSLIB_LIB STREQUAL "tgfclient")
IF(IN_SOURCETREE)
SET(INCLUDE_CANDIDATE ${SOURCE_DIR}/src/libs/tgfclient)
ELSE(IN_SOURCETREE)
SET(INCLUDE_CANDIDATE ${TORCS_INCLUDEDIR_ABS})
ENDIF(IN_SOURCETREE)
FIND_PATH(TORCSLIB_TGFCLIENT_INCLUDE_DIR tgfclient.h PATHS ${INCLUDE_CANDIDATE} /usr/include /usr/local/include NO_DEFAULT_PATH)
FIND_PATH(TORCSLIB_TGFCLIENT_INCLUDE_DIR tgfclient.h PATHS ${INCLUDE_CANDIDATE} /usr/include /usr/local/include)
SET(TORCSLIB_EXTRA_INCLUDEDIR TORCSLIB_TGFCLIENT_INCLUDE_DIR)
ELSEIF(TORCSLIB_LIB STREQUAL "txml")
IF(IN_SOURCETREE)
SET(INCLUDE_CANDIDATE ${SOURCE_DIR}/src/libs/txml)
ELSE(IN_SOURCETREE)
SET(INCLUDE_CANDIDATE ${TORCS_INCLUDEDIR_ABS})
ENDIF(IN_SOURCETREE)
FIND_PATH(TORCSLIB_TXML_INCLUDE_DIR xml.h PATHS ${INCLUDE_CANDIDATE} /usr/include /usr/local/include NO_DEFAULT_PATH)
FIND_PATH(TORCSLIB_TXML_INCLUDE_DIR xml.h PATHS ${INCLUDE_CANDIDATE} /usr/include /usr/local/include)
SET(TORCSLIB_EXTRA_INCLUDEDIR TORCSLIB_TXML_INCLUDE_DIR)
ELSE(TORCSLIB_LIB STREQUAL "client")
SET(TORCSLIB_FOUND_LIB FALSE)
IF(NOT TORCSLIB_LIB STREQUAL "OPTIONAL")
MESSAGE(WARNING ": ${TORCSLIB_LIB} is not a Speed Dreams library")
ENDIF(NOT TORCSLIB_LIB STREQUAL "OPTIONAL")
ENDIF(TORCSLIB_LIB STREQUAL "client")
IF(TORCSLIB_FOUND_LIB)
IF(${TORCSLIB_EXTRA_INCLUDEDIR})
SET(TORCSLIB_INCLUDE_DIRS ${TORCSLIB_INCLUDE_DIRS} ${${TORCSLIB_EXTRA_INCLUDEDIR}})
ELSE(${TORCSLIB_EXTRA_INCLUDEDIR})
IF(NOT TORCSLIB_OPTIONAL AND NOT TORCSLIB_LIB STREQUAL "OPTIONAL")
MESSAGE(FATAL_ERROR "Cannot find ${TORCSLIB_LIB} library header files")
ENDIF(NOT TORCSLIB_OPTIONAL AND NOT TORCSLIB_LIB STREQUAL "OPTIONAL")
ENDIF(${TORCSLIB_EXTRA_INCLUDEDIR})
ENDIF(TORCSLIB_FOUND_LIB)
ENDFOREACH(TORCSLIB_LIB ${TORCSLIB_LIBS})
INCLUDE_DIRECTORIES(${TORCSLIB_INCLUDE_DIRS})
ENDMACRO(ADD_TORCSLIB_INCLUDEDIR)
MACRO(ADD_TORCSLIB_LIBRARY TARGET)
SET(TORCSLIB_OPTIONAL FALSE)
SET(TORCSLIB_STATIC FALSE)
SET(TORCSLIB_TARGET_SUFFIX "")
FOREACH(TORCSLIB_LIB ${ARGN})
IF(${TORCSLIB_LIB} STREQUAL "OPTIONAL")
SET(TORCSLIB_OPTIONAL TRUE)
ENDIF(${TORCSLIB_LIB} STREQUAL "OPTIONAL")
IF(${TORCSLIB_LIB} STREQUAL "STATIC")
SET(TORCSLIB_STATIC TRUE)
SET(TORCSLIB_TARGET_SUFFIX "_static")
ENDIF(${TORCSLIB_LIB} STREQUAL "STATIC")
ENDFOREACH(TORCSLIB_LIB ${ARGN})
FOREACH(TORCSLIB_LIB ${ARGN})
SET(TORCSLIB_IGNORE TRUE)
IF(NOT UNIX)
SET(TORCSLIB_IGNORE FALSE)
ELSEIF(NOT TORCSLIB_LIB STREQUAL "ssggraph" AND NOT TORCSLIB_LIB STREQUAL "track")
SET(TORCSLIB_IGNORE FALSE)
ENDIF(NOT UNIX)
IF(TORCSLIB_LIB STREQUAL "OPTIONAL" OR TORCSLIB_LIB STREQUAL "STATIC")
SET(TORCSLIB_IGNORE TRUE) #Ignore: not a real target
ENDIF(TORCSLIB_LIB STREQUAL "OPTIONAL" OR TORCSLIB_LIB STREQUAL "STATIC")
IF(NOT TORCSLIB_IGNORE)
SET(TORCSLIB_FOUND_LIB TRUE)
SET(TORCSLIB_EXTRA_LIBRARY "")
#Use IF(TARGET ${TOCSLIB_LIB}) from CMake 2.6
GET_TARGET_PROPERTY(TORCSLIB_TARGET_LOCATION ${TORCSLIB_LIB}${TORCSLIB_TARGET_SUFFIX} LOCATION)
IF(NOT TORCSLIB_TARGET_LOCATION STREQUAL "NOTFOUND")
SET(TORCSLIB_LIBRARIES ${TORCSLIB_LIBRARIES} ${TORCSLIB_LIB}${TORCSLIB_TARGET_SUFFIX})
ELSE(NOT TORCSLIB_TARGET_LOCATION STREQUAL "NOTFOUND")
MESSAGE(WARNING "Warning: didn't found target ${TORCSLIB_LIB}")
IF(TORCSLIB_LIB STREQUAL "client")
IF(IN_SOURCETREE)
SET(LIBRARY_CANDIDATE ${SOURCE_DIR}/src/libs/client)
ELSE(IN_SOURCETREE)
SET(LIBRARY_CANDIDATE ${TORCS_LIBDIR_ABS})
ENDIF(IN_SOURCETREE)
FIND_LIBRARY(TORCSLIB_CLIENT_LIBRARY client PATHS ${LIBRARY_CANDIDATE} /usr/lib /usr/local/lib PATH_SUFFIXES "" lib)
SET(TORCSLIB_EXTRA_LIBRARY TORCSLIB_CLIENT_LIBRARY)
ELSEIF(TORCSLIB_LIB STREQUAL "confscreens")
IF(IN_SOURCETREE)
SET(LIBRARY_CANDIDATE ${SOURCE_DIR}/src/libs/confscreens)
ELSE(IN_SOURCETREE)
SET(LIBRARY_CANDIDATE ${TORCS_LIBDIR_ABS})
ENDIF(IN_SOURCETREE)
FIND_LIBRARY(TORCSLIB_CONFSCREENS_LIBRARY confscreens PATHS ${LIBRARY_CANDIDATE} /usr/lib /usr/local/lib PATH_SUFFIXES "" lib)
SET(TORCSLIB_EXTRA_LIBRARY TORCSLIB_CONFSCREENS_LIBRARY)
ELSEIF(TORCSLIB_LIB STREQUAL "learning")
IF(IN_SOURCETREE)
SET(LIBRARY_CANDIDATE ${SOURCE_DIR}/src/libs/learning)
ELSE(IN_SOURCETREE)
SET(LIBRARY_CANDIDATE ${TORCS_LIBDIR_ABS})
ENDIF(IN_SOURCETREE)
FIND_LIBRARY(TORCSLIB_LEARNING_LIBRARY learning PATHS ${LIBRARY_CANDIDATE} /usr/lib /usr/local/lib PATH_SUFFIXES "" lib)
SET(TORCSLIB_EXTRA_LIBRARY TORCSLIB_LEARNING_LIBRARY)
ELSEIF(TORCSLIB_LIB STREQUAL "networking")
IF(IN_SOURCETREE)
SET(LIBRARY_CANDIDATE ${SOURCE_DIR}/src/modules/networking)
ELSE(IN_SOURCETREE)
SET(LIBRARY_CANDIDATE ${TORCS_LIBDIR_ABS})
ENDIF(IN_SOURCETREE)
FIND_LIBRARY(TORCSLIB_NETWORKING_LIBRARY learning PATHS ${LIBRARY_CANDIDATE} /usr/lib /usr/local/lib PATH_SUFFIXES "" lib)
SET(TORCSLIB_EXTRA_LIBRARY TORCSLIB_NETWORKING_LIBRARY)
ELSEIF(TORCSLIB_LIB STREQUAL "raceengineclient" OR TORCSLIB_LIB STREQUAL "raceengine")
IF(IN_SOURCETREE)
SET(LIBRARY_CANDIDATE ${SOURCE_DIR}/src/libs/raceengineclient)
ELSE(IN_SOURCETREE)
SET(LIBRARY_CANDIDATE ${TORCS_LIBDIR_ABS})
ENDIF(IN_SOURCETREE)
FIND_LIBRARY(TORCSLIB_RACEENGINECLIENT_LIBRARY raceengine PATHS ${LIBRARY_CANDIDATE} /usr/lib /usr/local/lib PATH_SUFFIXES "" lib)
SET(TORCSLIB_EXTRA_LIBRARY TORCSLIB_RACEENGINECLIENT_LIBRARY)
ELSEIF(TORCSLIB_LIB STREQUAL "racescreens")
IF(IN_SOURCETREE)
SET(LIBRARY_CANDIDATE ${SOURCE_DIR}/src/libs/racescreens)
ELSE(IN_SOURCETREE)
SET(LIBRARY_CANDIDATE ${TORCS_LIBDIR_ABS})
ENDIF(IN_SOURCETREE)
FIND_LIBRARY(TORCSLIB_RACESCREENS_LIBRARY racescreens ${LIBRARY_CANDIDATE} /usr/lib /usr/local/lib PATH_SUFFIXES "" lib)
SET(TORCSLIB_EXTRA_LIBRARY TORCSLIB_RACESCREENS_LIBRARY)
ELSEIF(TORCSLIB_LIB STREQUAL "robottools")
IF(IN_SOURCETREE)
SET(LIBRARY_CANDIDATE ${SOURCE_DIR}/src/libs/robottools)
ELSE(IN_SOURCETREE)
SET(LIBRARY_CANDIDATE ${TORCS_LIBDIR_ABS})
ENDIF(IN_SOURCETREE)
FIND_LIBRARY(TORCSLIB_ROBOTTOOLS_LIBRARY robottools PATHS ${LIBRARY_CANDIDATE} /usr/lib /usr/local/lib PATH_SUFFIXES "" lib)
SET(TORCSLIB_EXTRA_LIBRARY TORCSLIB_ROBOTTOOLS_LIBRARY)
ELSEIF(TORCSLIB_LIB STREQUAL "tgf")
IF(IN_SOURCETREE)
SET(LIBRARY_CANDIDATE ${SOURCE_DIR}/src/libs/tgf)
ELSE(IN_SOURCETREE)
SET(LIBRARY_CANDIDATE ${TORCS_LIBDIR_ABS})
ENDIF(IN_SOURCETREE)
FIND_LIBRARY(TORCSLIB_TGF_LIBRARY tgf${TORCSLIB_TARGET_SUFFIX} PATHS ${LIBRARY_CANDIDATE} /usr/lib /usr/local/lib
PATH_SUFFIXES "" lib)
SET(TORCSLIB_EXTRA_LIBRARY TORCSLIB_TGF_LIBRARY)
ELSEIF(TORCSLIB_LIB STREQUAL "tgfclient")
IF(IN_SOURCETREE)
SET(LIBRARY_CANDIDATE ${SOURCE_DIR}/src/libs/tgfclient)
ELSE(IN_SOURCETREE)
SET(LIBRARY_CANDIDATE ${TORCS_LIBDIR_ABS})
ENDIF(IN_SOURCETREE)
FIND_LIBRARY(TORCSLIB_TGFCLIENT_LIBRARY tgfclient PATHS ${LIBRARY_CANDIDATE} /usr/lib /usr/local/lib PATH_SUFFIXES "" lib)
SET(TORCSLIB_EXTRA_LIBRARY TORCSLIB_TGFCLIENT_LIBRARY)
ELSEIF(TORCSLIB_LIB STREQUAL "txml")
IF(IN_SOURCETREE)
SET(LIBRARY_CANDIDATE ${SOURCE_DIR}/src/libs/txml)
ELSE(IN_SOURCETREE)
SET(LIBRARY_CANDIDATE ${TORCS_LIBDIR_ABS})
ENDIF(IN_SOURCETREE)
FIND_LIBRARY(TORCSLIB_TXML_LIBRARY txml${TORCSLIB_TARGET_SUFFIX} PATHS ${LIBRARY_CANDIDATE} /usr/lib /usr/local/lib
PATH_SUFFIXES "" lib)
SET(TORCSLIB_EXTRA_LIBRARY TORCSLIB_TXML_LIBRARY)
ELSEIF(TORCSLIB_LIB STREQUAL "ssggraph")
IF(IN_SOURCETREE)
SET(LIBRARY_CANDIDATE ${SOURCE_DIR}/src/modules/graphic/ssggraph)
ELSE(IN_SOURCETREE)
SET(LIBRARY_CANDIDATE ${TORCS_LIBDIR_ABS})
ENDIF(IN_SOURCETREE)
FIND_LIBRARY(TORCSLIB_SSGGRAPH_LIBRARY ssggraph PATHS ${LIBRARY_CANDIDATE} /usr/lib /usr/local/lib PATH_SUFFIXES "" lib)
SET(TORCSLIB_EXTRA_LIBRARY TORCSLIB_SSGGRAPH_LIBRARY)
ELSEIF(TORCSLIB_LIB STREQUAL "track")
IF(IN_SOURCETREE)
SET(LIBRARY_CANDIDATE ${SOURCE_DIR}/src/modules/track)
ELSE(IN_SOURCETREE)
SET(LIBRARY_CANDIDATE ${TORCS_LIBDIR_ABS})
ENDIF(IN_SOURCETREE)
FIND_LIBRARY(TORCSLIB_TRACK_LIBRARY track PATHS ${LIBRARY_CANDIDATE} /usr/lib /usr/local/lib PATH_SUFFIXES "" lib)
SET(TORCSLIB_EXTRA_LIBRARY TORCSLIB_TRACK_LIBRARY)
ELSE(TORCSLIB_LIB STREQUAL "client")
SET(TORCSLIB_FOUND_LIB FALSE)
IF(NOT TORCSLIB_LIB STREQUAL "OPTIONAL" AND NOT TORCSLIB_LIB STREQUAL "STATIC")
MESSAGE(WARNING ": ${TORCSLIB_LIB} is not a Speed Dreams library")
ENDIF(NOT TORCSLIB_LIB STREQUAL "OPTIONAL" AND NOT TORCSLIB_LIB STREQUAL "STATIC")
ENDIF(TORCSLIB_LIB STREQUAL "client")
IF(TORCSLIB_FOUND_LIB)
IF(${TORCSLIB_EXTRA_LIBRARY})
SET(TORCSLIB_LIBRARIES ${TORCSLIB_LIBRARIES} ${${TORCSLIB_EXTRA_LIBRARY}})
ELSE(${TORCSLIB_EXTRA_LIBRARY})
IF(NOT TORCSLIB_OPTIONAL AND NOT TORCSLIB_LIB STREQUAL "OPTIONAL" AND NOT TORCSLIB_LIB STREQUAL "STATIC")
MESSAGE(FATAL_ERROR "Cannot find ${TORCSLIB_LIB} library shared object")
ENDIF(NOT TORCSLIB_OPTIONAL AND NOT TORCSLIB_LIB STREQUAL "OPTIONAL" AND NOT TORCSLIB_LIB STREQUAL "STATIC")
ENDIF(${TORCSLIB_EXTRA_LIBRARY})
ENDIF(TORCSLIB_FOUND_LIB)
ENDIF(NOT TORCSLIB_TARGET_LOCATION STREQUAL "NOTFOUND")
ENDIF(NOT TORCSLIB_IGNORE)
ENDFOREACH(TORCSLIB_LIB ${TORCSLIB_LIBS})
TARGET_LINK_LIBRARIES(${TARGET} ${TORCSLIB_LIBRARIES})
ENDMACRO(ADD_TORCSLIB_LIBRARY TARGET)
MACRO(ADD_PLIB_INCLUDEDIR)
FIND_PACKAGE(PLIB)
IF(PLIB_FOUND)
INCLUDE_DIRECTORIES(${PLIB_INCLUDE_DIR})
ELSE(PLIB_FOUND)
MESSAGE(FATAL_ERROR "Cannot find plib header files")
ENDIF(PLIB_FOUND)
ENDMACRO(ADD_PLIB_INCLUDEDIR)
MACRO(ADD_PLIB_LIBRARY TARGET)
FIND_PACKAGE(PLIB)
IF(NOT PLIB_FOUND)
MESSAGE(FATAL_ERROR "Cannot find plib")
ENDIF(NOT PLIB_FOUND)
IF(NOT APPLE)
FOREACH(PLIB_LIB ${ARGN})
IF(PLIB_LIB STREQUAL "ul")
SET(PLIB_LIBRARIES ${PLIB_LIBRARIES} ${PLIB_UL_LIBRARY})
ELSEIF(PLIB_LIB STREQUAL "js")
SET(PLIB_LIBRARIES ${PLIB_LIBRARIES} ${PLIB_JS_LIBRARY})
ELSEIF(PLIB_LIB STREQUAL "sg")
SET(PLIB_LIBRARIES ${PLIB_LIBRARIES} ${PLIB_SG_LIBRARY})
ELSEIF(PLIB_LIB STREQUAL "sl")
SET(PLIB_LIBRARIES ${PLIB_LIBRARIES} ${PLIB_SL_LIBRARY})
ELSEIF(PLIB_LIB STREQUAL "sm")
SET(PLIB_LIBRARIES ${PLIB_LIBRARIES} ${PLIB_SM_LIBRARY})
ELSEIF(PLIB_LIB STREQUAL "ssg")
SET(PLIB_LIBRARIES ${PLIB_LIBRARIES} ${PLIB_SSG_LIBRARY})
ELSEIF(PLIB_LIB STREQUAL "ssgaux")
SET(PLIB_LIBRARIES ${PLIB_LIBRARIES} ${PLIB_SSGAUX_LIBRARY})
ELSE(PLIB_LIB STREQUAL "ul")
MESSAGE(WARNING "${PLIB_LIB} is not part of plib")
ENDIF(PLIB_LIB STREQUAL "ul")
ENDFOREACH(PLIB_LIB ${ARGN})
ENDIF(NOT APPLE)
#Special case apple only uses one library
IF(APPLE)
SET(PLIB_LIBRARIES ${PLIB_LIBRARIES} ${PLIB_APPLE_LIBRARY})
ENDIF(APPLE)
TARGET_LINK_LIBRARIES(${TARGET} ${PLIB_LIBRARIES})
ENDMACRO(ADD_PLIB_LIBRARY TARGET)
MACRO(ADD_SDL_INCLUDEDIR)
FIND_PACKAGE(SDL)
IF(SDL_FOUND)
INCLUDE_DIRECTORIES(${SDL_INCLUDE_DIR})
ELSE(SDL_FOUND)
MESSAGE(FATAL_ERROR "Cannot find SDL header files")
ENDIF(SDL_FOUND)
ENDMACRO(ADD_SDL_INCLUDEDIR)
MACRO(ADD_SDL_LIBRARY TARGET)
FIND_PACKAGE(SDL)
IF(SDL_FOUND)
TARGET_LINK_LIBRARIES(${TARGET} ${SDL_LIBRARY})
IF(SDLMAIN_LIBRARY)
TARGET_LINK_LIBRARIES(${TARGET} ${SDLMAIN_LIBRARY})
ENDIF(SDLMAIN_LIBRARY)
ELSE(SDL_FOUND)
MESSAGE(FATAL_ERROR "Cannot find SDL library")
ENDIF(SDL_FOUND)
ENDMACRO(ADD_SDL_LIBRARY TARGET)
MACRO(ADD_OPENGL_INCLUDEDIR)
FIND_PACKAGE(OpenGL)
IF(OPENGL_FOUND)
INCLUDE_DIRECTORIES(${OPENGL_INCLUDE_DIR})
ELSE(OPENGL_FOUND)
MESSAGE(FATAL_ERROR "Cannot find OpenGL header files")
ENDIF(OPENGL_FOUND)
ENDMACRO(ADD_OPENGL_INCLUDEDIR)
MACRO(ADD_OPENGL_LIBRARY TARGET)
FIND_PACKAGE(OpenGL)
IF(OPENGL_FOUND)
TARGET_LINK_LIBRARIES(${TARGET} ${OPENGL_LIBRARIES})
ELSE(OPENGL_FOUND)
MESSAGE(FATAL_ERROR "Cannot find OpenGL libraries")
ENDIF(OPENGL_FOUND)
ENDMACRO(ADD_OPENGL_LIBRARY TARGET)
MACRO(ADD_OPENAL_INCLUDEDIR)
FIND_PACKAGE(OpenAL)
IF(OPENAL_FOUND)
INCLUDE_DIRECTORIES(${OPENAL_INCLUDE_DIR})
ELSE(OPENAL_FOUND)
MESSAGE(FATAL_ERROR "Cannot find OpenAL header files")
ENDIF(OPENAL_FOUND)
ENDMACRO(ADD_OPENAL_INCLUDEDIR)
MACRO(ADD_OPENAL_LIBRARY TARGET)
FIND_PACKAGE(OpenAL)
IF(OPENAL_FOUND)
TARGET_LINK_LIBRARIES(${TARGET} ${OPENAL_LIBRARIES})
ELSE(OPENAL_FOUND)
MESSAGE(FATAL_ERROR "Cannot find OpenAL libraries")
ENDIF(OPENAL_FOUND)
ENDMACRO(ADD_OPENAL_LIBRARY TARGET)
MACRO(ADD_ENET_INCLUDEDIR)
FIND_PACKAGE(ENET)
IF(ENET_FOUND)
INCLUDE_DIRECTORIES(${ENET_INCLUDE_DIR})
ELSE(ENET_FOUND)
MESSAGE(FATAL_ERROR "Cannot find ENET header files")
ENDIF(ENET_FOUND)
ENDMACRO(ADD_ENET_INCLUDEDIR)
MACRO(ADD_ENET_LIBRARY TARGET)
FIND_PACKAGE(ENET)
IF(ENET_FOUND)
TARGET_LINK_LIBRARIES(${TARGET} ${ENET_LIBRARY})
ELSE(ENET_FOUND)
MESSAGE(FATAL_ERROR "Cannot find ENET libraries")
ENDIF(ENET_FOUND)
ENDMACRO(ADD_ENET_LIBRARY TARGET)
MACRO(ADD_PNG_INCLUDEDIR)
FIND_PACKAGE(PNG)
IF(PNG_FOUND)
INCLUDE_DIRECTORIES(${PNG_INCLUDE_DIR})
ELSE(PNG_FOUND)
MESSAGE(FATAL_ERROR "Cannot find PNG header files")
ENDIF(PNG_FOUND)
ENDMACRO(ADD_PNG_INCLUDEDIR)
MACRO(ADD_PNG_LIBRARY TARGET)
FIND_PACKAGE(PNG)
IF(PNG_FOUND)
TARGET_LINK_LIBRARIES(${TARGET} ${PNG_LIBRARIES})
ELSE(PNG_FOUND)
MESSAGE(FATAL_ERROR "Cannot find PNG libraries")
ENDIF(PNG_FOUND)
ENDMACRO(ADD_PNG_LIBRARY TARGET)
MACRO(ADD_JPEG_INCLUDEDIR)
FIND_PACKAGE(JPEG)
IF(JPEG_FOUND)
INCLUDE_DIRECTORIES(${JPEG_INCLUDE_DIR})
ELSE(JPEG_FOUND)
MESSAGE(FATAL_ERROR "Cannot find JPEG header files")
ENDIF(JPEG_FOUND)
ENDMACRO(ADD_JPEG_INCLUDEDIR)
MACRO(ADD_JPEG_LIBRARY TARGET)
FIND_PACKAGE(JPEG)
IF(JPEG_FOUND)
TARGET_LINK_LIBRARIES(${TARGET} ${JPEG_LIBRARIES})
ELSE(JPEG_FOUND)
MESSAGE(FATAL_ERROR "Cannot find JPEG libraries")
ENDIF(JPEG_FOUND)
ENDMACRO(ADD_JPEG_LIBRARY TARGET)
MACRO(ADD_X11_INCLUDEDIR)
FIND_PACKAGE(X11)
IF(X11_FOUND)
INCLUDE_DIRECTORIES(${X11_INCLUDE_DIR})
MESSAGE(STATUS "INCLUDED ${X11_INCLUDE_DIR}")
ELSE(X11_FOUND)
MESSAGE(FATAL_ERROR "Cannot find X11 header files")
ENDIF(X11_FOUND)
ENDMACRO(ADD_X11_INCLUDEDIR)
MACRO(ADD_X11_LIBRARY TARGET)
FIND_PACKAGE(X11)
IF(X11_FOUND)
TARGET_LINK_LIBRARIES(${TARGET} ${X11_LIBRARIES})
ELSE(X11_FOUND)
MESSAGE(FATAL_ERROR "Cannot find X11 libraries")
ENDIF(X11_FOUND)
ENDMACRO(ADD_X11_LIBRARY TARGET)
MACRO(ADD_XRANDR_INCLUDEDIR)
FIND_PACKAGE(X11)
FIND_PATH(X11_Xrandr_INCLUDE_PATH X11/extensions/Xrandr.h ${X11_INC_SEARCH_PATH})
IF(X11_Xrandr_INCLUDE_PATH)
INCLUDE_DIRECTORIES(${X11_Xrandr_INCLUDE_PATH} ${X11_INCLUDE_DIR})
SET(HAVE_XRANDR TRUE)
ELSE(X11_Xrandr_INCLUDE_PATH)
SET(HAVE_XRANDR FALSE)
ENDIF(X11_Xrandr_INCLUDE_PATH)
ENDMACRO(ADD_XRANDR_INCLUDEDIR)
MACRO(ADD_XRANDR_LIBRARY TARGET)
FIND_PACKAGE(X11)
FIND_LIBRARY(X11_Xrandr_LIB Xrandr ${X11_LIB_SEARCH_PATH})
IF(X11_Xrandr_LIB)
TARGET_LINK_LIBRARIES(${TARGET} ${X11_Xrandr_LIB})
SET(HAVE_XRANDR TRUE)
ELSE(X11_Xrandr_LIB)
SET(HAVE_XRANDR FALSE)
ENDIF(X11_Xrandr_LIB)
ENDMACRO(ADD_XRANDR_LIBRARY TARGET)
#Some unix compilers need libdl
MACRO(ADD_DL_LIBRARY TARGET)
IF(UNIX)
FIND_LIBRARY(LIBDL_LIB dl "")
IF(LIBDL_LIB)
TARGET_LINK_LIBRARIES(${TARGET} ${LIBDL_LIB})
ENDIF(LIBDL_LIB)
MESSAGE(STATUS LIBDL = ${LIBDL_LIB})
ENDIF(UNIX)
ENDMACRO(ADD_DL_LIBRARY TARGET)
MACRO(ADD_TORCS_DEFINITIONS)
IF(HAVE_CONFIG_H)
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
IF(IN_SOURCETREE)
SET(INCLUDE_CANDIDATE ${SOURCE_DIR})
ELSE(IN_SOURCETREE)
SET(INCLUDE_CANDIDATE "")
ENDIF(IN_SOURCETREE)
FIND_PATH(CONFIGH_INCLUDE_DIR config.h ${INCLUDE_CANDIDATE} /usr/include /usr/local/include NO_DEFAULT_PATH)
FIND_PATH(CONFIGH_INCLUDE_DIR config.h ${INCLUDE_CANDIDATE} /usr/include /usr/local/include)
IF(CONFIGH_INCLUDE_DIR)
INCLUDE_DIRECTORIES(${CONFIGH_INCLUDE_DIR})
ELSE(CONFIGH_INCLUDE_DIR)
MESSAGE(FATAL_ERROR "Cannot find config.h header file")
ENDIF(CONFIGH_INCLUDE_DIR)
ENDIF(HAVE_CONFIG_H)
ADD_DEFINITIONS(-D_SVID_SOURCE -D_BSD_SOURCE -DSHM)
SET(OPTION_DEBUG false CACHE BOOL "Enable traces into the console or log file")
SET(OPTION_TRACE_LEVEL "2" CACHE STRING "Trace level integer threshold, only if OPTION_DEBUG (traces with higher level are not logged ; 0=Fatal, 1=Error, 2=Warning, 3=Info, 4=Trace, 5=Debug, ...)")
SET(OPTION_PROFILER false CACHE BOOL "Enable profiler")
SET(OPTION_SCHEDULE_SPY false CACHE BOOL "Enable fine grained scheduling spy")
#Put Linux spec here
IF(UNIX)
SET(OPTION_XRANDR true CACHE BOOL "XrandR")
SET(OPTION_GLEXTPROTOTYPES true CACHE BOOL "Enable prototypes in glext.h")
ENDIF(UNIX)
#Put Windows spec here
IF(WIN32)
#suppress meaningless warning for MSVC
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS)
ENDIF(WIN32)
if(OPTION_DEBUG)
ADD_DEFINITIONS(-DDEBUG -DTRACE_OUT)
ENDIF(OPTION_DEBUG)
if(OPTION_TRACE_LEVEL)
ADD_DEFINITIONS(-DTRACE_LEVEL=${OPTION_TRACE_LEVEL})
ENDIF(OPTION_TRACE_LEVEL)
IF(OPTION_XRANDR)
ADD_DEFINITIONS(-DUSE_RANDR_EXT)
ENDIF(OPTION_XRANDR)
IF(OPTION_PROFILER)
ADD_DEFINITIONS(-DPROFILER)
ENDIF(OPTION_PROFILER)
IF(OPTION_SCHEDULE_SPY)
ADD_DEFINITIONS(-DSCHEDULE_SPY)
ENDIF(OPTION_SCHEDULE_SPY)
IF(OPTION_GLEXTPROTOTYPES)
ADD_DEFINITIONS(-DGL_GLEXT_PROTOTYPES)
ENDIF(OPTION_GLEXTPROTOTYPES)
# Define for code that needs Torcs backward compatibility
ADD_DEFINITIONS(-DSPEED_DREAMS)
ENDMACRO(ADD_TORCS_DEFINITIONS)
MACRO(TORCS_INSTALL_CAR carname)
SET(files ${carname}.xml ${ARGN})
FILE(GLOB files_acc *.acc)
FILE(GLOB files_rgb *.rgb)
FILE(GLOB files_png *.png)
FILE(GLOB files_jpg *.jpg)
FILE(GLOB files_wav *.wav)
SET(files ${files} ${files_acc} ${files_rgb} ${files_png} ${files_jpg} ${files_wav})
TORCS_INSTALL_FILES(DATA cars/${carname} FILES ${files})
ENDMACRO(TORCS_INSTALL_CAR carname)
MACRO(TORCS_INSTALL_TRACK trackname category)
SET(files ${trackname}.xml ${ARGN})
FILE(GLOB files_png *.png)
FILE(GLOB files_rgb *.rgb)
FILE(GLOB files_ac *.ac)
FILE(GLOB files_acc *.acc)
SET(files ${files} ${files_png} ${files_rgb} ${files_ac} ${files_acc})
TORCS_INSTALL_FILES(DATA tracks/${category}/${trackname} FILES ${files})
ENDMACRO(TORCS_INSTALL_TRACK trackname category)
#Usage:
# TORCS_INSTALL_FILES(DATA drivers/bt FILES bt.xml logo.rgb)
# Installs the files quickrace.xml and endrace.xml in ${prefix}/share/games/speed-dreams/drivers/bt
# TORCS_INSTALL_FILES(DATA config/raceman USER config/raceman FILES quickrace.xml endrace.xml)
# Installs the files quickrace.xml and endrace.xml in ${prefix}/share/games/speed-dreams/drivers/bt
# and copies the file to the users home directory ~/.speed-dreams/config/raceman at startup.
# TORCS_INSTALL_FILES(LIB drivers/bt TARGETS bt.so)
# Installs the files bt.so in ${prefix}/lib/speed-dreams/drivers/bt
# TORCS_INSTALL_FILES(BIN TARGETS speed-dreams)
# Installs the speed-dreams target to the bin-directory
MACRO(TORCS_INSTALL_FILES)
SET(TORCS_INSTALL_FILES_SYNTAX "DATA,1,1,IS_DATA,DATA_PATH")
SET(TORCS_INSTALL_FILES_SYNTAX ${TORCS_INSTALL_FILES_SYNTAX} "LIB,1,1,IS_LIB,LIB_PATH")
SET(TORCS_INSTALL_FILES_SYNTAX ${TORCS_INSTALL_FILES_SYNTAX} "BIN,0,0,IS_BIN,BIN_PATH")
SET(TORCS_INSTALL_FILES_SYNTAX ${TORCS_INSTALL_FILES_SYNTAX} "INCLUDE,0,1,IS_INCLUDE,INCLUDE_PATH")
SET(TORCS_INSTALL_FILES_SYNTAX ${TORCS_INSTALL_FILES_SYNTAX} "USER,1,1,IS_USER,USER_PATH")
SET(TORCS_INSTALL_FILES_SYNTAX ${TORCS_INSTALL_FILES_SYNTAX} "FILES,0,-1,HAS_FILES,FILES")
SET(TORCS_INSTALL_FILES_SYNTAX ${TORCS_INSTALL_FILES_SYNTAX} "TARGETS,0,-1,HAS_TARGETS,TARGET_LIST")
SPLIT_ARGN(${TORCS_INSTALL_FILES_SYNTAX} ARGUMENTS ${ARGN})
IF(NOT IS_DATA AND NOT IS_LIB AND NOT IS_BIN AND NOT IS_INCLUDE)
MESSAGE(ERROR "Expected either LIB, DATA or BIN in TORCS_INSTALL_FILES")
ENDIF(NOT IS_DATA AND NOT IS_LIB AND NOT IS_BIN AND NOT IS_INCLUDE)
IF(IS_LIB)
SET(DEST1 ${TORCS_LIBDIR})
SET(DEST2 ${LIB_PATH})
ELSEIF(IS_DATA)
SET(DEST1 ${TORCS_DATADIR})
SET(DEST2 ${DATA_PATH})
ELSEIF(IS_BIN)
SET(DEST1 ${TORCS_BINDIR})
SET(DEST2 "")
ELSEIF(IS_INCLUDE)
SET(DEST1 ${TORCS_INCLUDEDIR})
SET(DEST2 "${INCLUDE_PATH}")
ELSE(IS_LIB)
MESSAGE(WARNING "TORCS_INSTALL_FILES called without DATA, LIB, BIN or INCLUDE command")
ENDIF(IS_LIB)
IF(DEST2 STREQUAL "" OR DEST2 STREQUAL ".")
SET(DEST2 "")
SET(DEST_ALL "${DEST1}")
ELSE(DEST2 STREQUAL "" OR DEST2 STREQUAL ".")
SET(DEST_ALL "${DEST1}/${DEST2}")
ENDIF(DEST2 STREQUAL "" OR DEST2 STREQUAL ".")
#Install files
IF(HAS_FILES)
INSTALL(FILES ${FILES} DESTINATION ${DEST_ALL})
ENDIF(HAS_FILES)
IF(HAS_TARGETS)
INSTALL(TARGETS ${TARGET_LIST} DESTINATION ${DEST_ALL})
ENDIF(HAS_TARGETS)
#Loop through all the files which must be installed
IF(IS_USER)
FOREACH(XML_FILE ${FILES})
#Get the filename
GET_FILENAME_COMPONENT(XMLFILENAME ${XML_FILE} NAME)
#Execute xmlversion to get the file in the users home directory
IF(WIN32)
GET_TARGET_PROPERTY(TXML_LIB txml LOCATION)
GET_TARGET_PROPERTY(TGF_LIB tgf LOCATION)
INSTALL(CODE "FILE(READ ${CMAKE_BINARY_DIR}/xmlversion_loc.txt XMLVERSION_EXE)
STRING(REPLACE \"$(OutDir)\" \"\${CMAKE_INSTALL_CONFIG_NAME}\" XMLVERSION_EXE \${XMLVERSION_EXE})
GET_FILENAME_COMPONENT(XMLVERSION_DIR \${XMLVERSION_EXE} PATH)
SET(TXML_LIB ${TXML_LIB})
STRING(REPLACE \"$(OutDir)\" \"\${CMAKE_INSTALL_CONFIG_NAME}\" TXML_LIB \${TXML_LIB})
SET(TGF_LIB ${TGF_LIB})
STRING(REPLACE \"$(OutDir)\" \"\${CMAKE_INSTALL_CONFIG_NAME}\" TGF_LIB \${TGF_LIB})
FILE(INSTALL DESTINATION \${XMLVERSION_DIR} TYPE FILE FILES \${TXML_LIB} \${TGF_LIB})
EXECUTE_PROCESS(COMMAND \"\${XMLVERSION_EXE}\" \"${CMAKE_BINARY_DIR}/version.xml\" \"${CMAKE_INSTALL_PREFIX}/${DEST_ALL}/${XMLFILENAME}\" \"${USER_PATH}/${XMLFILENAME}\" RESULT_VARIABLE XMLVERSTATUS)
IF(XMLVERSTATUS)
MESSAGE(FATAL_ERROR \"ERROR: xmlversion failed\")
ENDIF(XMLVERSTATUS)")
INSTALL(FILES ${CMAKE_BINARY_DIR}/version.xml DESTINATION ${TORCS_DATADIR})
ELSE(WIN32)
INSTALL(CODE "FILE(READ ${CMAKE_BINARY_DIR}/xmlversion_loc.txt XMLVERSION_EXE)
SET(CUR_DESTDIR \"\$ENV{DESTDIR}\")
IF(CUR_DESTDIR MATCHES \"[^/]\")
STRING(REGEX REPLACE \"^(.*[^/])/*$\" \"\\\\1\" CUR_DESTDIR_CORR \"\${CUR_DESTDIR}\")
ELSE(CUR_DESTDIR MATCHES \"[^/]\")
SET(CUR_DESTDIR_CORR \"\")
ENDIF(CUR_DESTDIR MATCHES \"[^/]\")
EXECUTE_PROCESS(COMMAND \${XMLVERSION_EXE} \${CMAKE_BINARY_DIR}/version.xml \${CUR_DESTDIR_CORR}${CMAKE_INSTALL_PREFIX}/${DEST_ALL}/${XMLFILENAME} ${USER_PATH}/${XMLFILENAME} RESULT_VARIABLE XMLVERSTATUS)
IF(XMLVERSTATUS)
MESSAGE(FATAL_ERROR \"ERROR: xmlversion failed\")
ENDIF(XMLVERSTATUS)")
INSTALL(FILES ${CMAKE_BINARY_DIR}/version.xml DESTINATION ${CUR_DESTDIR_CORR}${TORCS_DATADIR_ABS})
ENDIF(WIN32)
ENDFOREACH(XML_FILE ${FILES})
ENDIF(IS_USER)
ENDMACRO(TORCS_INSTALL_FILES)
IF(IN_SOURCETREE)
MACRO(INSTALL_TORCSNG_CMAKE)
INSTALL(CODE "SET(CUR_DESTDIR \"\$ENV{DESTDIR}\")
IF(CUR_DESTDIR MATCHES \"[^/]\")
STRING(REGEX REPLACE \"^(.*[^/])/*$\" \"\\\\1\" CUR_DESTDIR_CORR \"\${CUR_DESTDIR}\")
ELSE(CUR_DESTDIR MATCHES \"[^/]\")
SET(CUR_DESTDIR_CORR \"\")
ENDIF(CUR_DESTDIR MATCHES \"[^/]\")
FILE(MAKE_DIRECTORY \"\${CUR_DESTDIR_CORR}${TORCS_DATADIR_ABS}/cmake\")
FILE(WRITE \"\${CUR_DESTDIR_CORR}${TORCS_DATADIR_ABS}/cmake/speed-dreams.cmake\" \"SET(TORCS_DATADIR_ABS \\\"${TORCS_DATADIR_ABS}\\\")
SET(TORCS_LOCALDIR \\\"${TORCS_LOCALDIR}\\\")
SET(TORCS_LIBDIR_ABS \\\"${TORCS_LIBDIR_ABS}\\\")
SET(TORCS_BINDIR_ABS \\\"${TORCS_BINDIR_ABS}\\\")
SET(TORCS_INCLUDEDIR_ABS \\\"${TORCS_INCLUDEDIR_ABS}\\\")
SET(IN_SOURCETREE FALSE)\\n\\n\")
FILE(READ \"${SOURCE_DIR}/cmake/macros.cmake\" TORCS_MACRO_CONTENT)
FILE(APPEND \"\${CUR_DESTDIR_CORR}${TORCS_DATADIR_ABS}/cmake/speed-dreams.cmake\" \${TORCS_MACRO_CONTENT})")
ENDMACRO(INSTALL_TORCSNG_CMAKE)
ENDIF(IN_SOURCETREE)
ADD_TORCS_DEFINITIONS()