cmake: Remove IN_SOURCETREE

config.h is always generated from config.h.in.cmake, so IN_SOURCETREE
did not provide any actual value.
This commit is contained in:
Xavier Del Campo Romero 2025-01-17 06:40:15 +01:00
parent c5266013fc
commit e26c923811
Signed by: xavi
GPG key ID: 84FF3612A9BF43F2
3 changed files with 4 additions and 45 deletions

View file

@ -20,11 +20,6 @@
#MESSAGE(STATUS "Processing ${CMAKE_CURRENT_SOURCE_DIR} ...")
# By default, we assume an "in-source" build.
IF(NOT DEFINED IN_SOURCETREE)
SET(IN_SOURCETREE TRUE)
ENDIF(NOT DEFINED IN_SOURCETREE)
# Setup the install prefix.
IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
IF(WIN32)
@ -41,20 +36,6 @@ IF(NOT _ALREADY_DONE)
INCLUDE(${CMAKE_CURRENT_LIST_DIR}/splitargn.cmake)
ENDIF(NOT _ALREADY_DONE)
# Include dir for config.h
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})
MARK_AS_ADVANCED(CONFIGH_INCLUDE_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)
# Determine the default value of the user settings folder.
IF(WIN32)
SET(SD_LOCALDIR "~/speed-dreams-2.settings" CACHE STRING "Where the user settings files should go")
@ -321,6 +302,9 @@ MACRO(SD_GENERATE_CLOBBER_SCRIPT)
ENDMACRO(SD_GENERATE_CLOBBER_SCRIPT)
ADD_COMPILE_DEFINITIONS(HAVE_CONFIG_H)
INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR})
# Add non-default compile options.
ADD_SD_COMPILE_OPTIONS()

View file

@ -22,27 +22,6 @@ INCLUDE(CMakeDependentOption)
MACRO(ADD_SD_COMPILE_OPTIONS)
# This has to be done more than once, because HAVE_CONFIG_H may change.
IF(HAVE_CONFIG_H)
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
IF(IN_SOURCETREE)
SET(INCLUDE_CANDIDATE ${CMAKE_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)
MARK_AS_ADVANCED(CONFIGH_INCLUDE_DIR)
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)
# Build options (do it only once).
IF(NOT _ALREADY_DONE)

View file

@ -64,11 +64,7 @@ MACRO(GENERATE_ROBOT_DEF_FILE ROBOTNAME DEF_FILE)
# Generate the .def file
SET(ROBOT_NAME "${ROBOTNAME}")
IF(IN_SOURCETREE)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/robot.def.in.cmake ${DEF_FILE})
ELSE(IN_SOURCETREE)
CONFIGURE_FILE(${SD_DATADIR}/cmake/robot.def.in.cmake ${DEF_FILE})
ENDIF(IN_SOURCETREE)
CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/cmake/robot.def.in.cmake ${DEF_FILE})
ENDMACRO(GENERATE_ROBOT_DEF_FILE ROBOTNAME DEF_FILE)