Re #253 (CMake does not work with 2.6) Trying some simplications on IF expressions

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

Former-commit-id: f498809642f639d799505e1c4a298f32d35a30f0
Former-commit-id: 01654a4e05b485c66fabda76661dcaf83e68b2b2
This commit is contained in:
pouillot 2010-11-06 10:22:54 +00:00
parent f4d248ccc5
commit 90ddb1a8a0

View file

@ -1037,13 +1037,40 @@ MACRO(SD_INSTALL_FILES)
#MESSAGE(STATUS " SD_INSTALL_FILES: LIB=${IS_LIB}:${LIB_PATH} BIN=${IS_BIN} INCLUDE=${IS_INCLUDE}:${INCLUDE_PATH} DATA=${IS_DATA}:${DATA_PATH} USER=${IS_USER}:${USER_PATH} TARGETS=${HAS_TARGETS}:${TARGETS} FILES=${HAS_FILES}:${FILES}")
# Check argument syntax / values
IF(NOT (IS_DATA AND DATA_PATH) AND NOT (IS_LIB AND LIB_PATH) AND NOT IS_BIN AND NOT IS_INCLUDE)
# Fix/Check argument syntax / values
IF(NOT DATA_PATH)
SET(IS_DATA FALSE)
ENDIF()
IF(NOT USER_PATH)
SET(IS_USER FALSE)
ENDIF()
IF(NOT LIB_PATH)
SET(IS_LIB FALSE)
ENDIF()
IF(NOT PREFIX)
SET(HAS_PREFIX FALSE)
ENDIF()
IF(NOT FILES)
SET(HAS_FILES FALSE)
ENDIF()
IF(NOT TARGETS)
SET(HAS_TARGETS FALSE)
ENDIF()
IF(IS_DATA OR IS_LIB OR IS_BIN OR IS_INCLUDE)
IF(HAS_PREFIX)
IF(NOT HAS_FILES)
MESSAGE(FATAL_ERROR "SD_INSTALL_FILES: Expected FILES when PREFIX keyword is present")
ENDIF()
ENDIF()
ELSE()
MESSAGE(FATAL_ERROR "SD_INSTALL_FILES: Expected 1 and only 1 LIB, DATA, BIN or INCLUDE keyword")
ENDIF()
IF(HAS_PREFIX AND PREFIX AND NOT (HAS_FILES AND FILES))
MESSAGE(FATAL_ERROR "SD_INSTALL_FILES: Expected FILES when PREFIX keyword is present")
IF(IS_USER)
IF(NOT IS_DATA)
MESSAGE(FATAL_ERROR "SD_INSTALL_FILES: Expected DATA when USER keyword is present")
ENDIF()
ENDIF()
# Compute destination sub-dir
@ -1070,8 +1097,8 @@ MACRO(SD_INSTALL_FILES)
# Prepend prefix to files if specified.
SET(REAL_FILES) # Reset the list (remember, it's a CMakeLists.txt global variable :-()
IF(HAS_FILES AND FILES)
IF(HAS_PREFIX AND PREFIX)
IF(HAS_FILES)
IF(HAS_PREFIX)
FOREACH(FILE ${FILES})
LIST(APPEND REAL_FILES ${PREFIX}/${FILE})
ENDFOREACH()
@ -1086,7 +1113,7 @@ MACRO(SD_INSTALL_FILES)
ENDIF()
# Install targets
IF(HAS_TARGETS AND TARGETS)
IF(HAS_TARGETS)
INSTALL(TARGETS ${TARGETS} DESTINATION ${DEST_ALL})
ENDIF()
@ -1094,7 +1121,7 @@ MACRO(SD_INSTALL_FILES)
IF(IS_USER)
# Handle properly the "root" folder case.
IF(DATA_PATH STREQUAL "" OR DATA_PATH STREQUAL "/")
IF(DATA_PATH STREQUAL "/")
SET(DATA_PATH "")
ELSE()
SET(DATA_PATH "${DATA_PATH}/")
@ -1187,31 +1214,41 @@ MACRO(SD_INSTALL_DIRECTORIES)
#MESSAGE(STATUS " SD_INSTALL_DIRECTORIES: DATA=${IS_DATA}:${DATA_PATH} USER=${IS_USER}:${USER_PATH} DIRS=${HAS_DIRECTORIES}:${DIRECTORIES} PATTERNS=${HAS_PATTERNS}:${PATTERNS}")
# Check arguments syntax / values
IF(NOT (IS_DATA AND DATA_PATH) AND NOT(HAS_DIRECTORIES AND DIRECTORIES))
MESSAGE(ERROR "SD_INSTALL_DIRECTORIES: Expected mandatory DATA and DIRECTORIES keywords")
# Fix/Check argument syntax / values
IF(NOT DATA_PATH)
SET(IS_DATA FALSE)
ENDIF()
IF(NOT(HAS_PATTERNS AND PATTERNS))
IF(NOT USER_PATH)
SET(IS_USER FALSE)
ENDIF()
IF(NOT PREFIX)
SET(HAS_PREFIX FALSE)
ENDIF()
IF(NOT DIRECTORIES)
SET(HAS_DIRECTORIES FALSE)
ENDIF()
IF(NOT PATTERNS)
SET(HAS_PATTERNS TRUE)
SET(PATTERNS "*.*")
ENDIF()
IF(HAS_PREFIX AND PREFIX)
IF(IS_DATA AND HAS_DIRECTORIES)
IF(HAS_PREFIX)
SET(PREFIX "${PREFIX}/")
SET(POSTFIX "/${PREFIX}")
ELSE()
SET(PREFIX "")
SET(POSTFIX "")
ENDIF()
ELSE()
MESSAGE(ERROR "SD_INSTALL_DIRECTORIES: Expected mandatory DATA and DIRECTORIES keywords")
ENDIF()
# Compute destination sub-dir
SET(DEST1 ${SD_DATADIR})
SET(DEST2 ${DATA_PATH})
IF(DEST2 STREQUAL "" OR DEST2 STREQUAL "/")
SET(DEST2 "")
SET(DEST_ALL "${DEST1}")
IF(DATA_PATH STREQUAL "/")
SET(DEST_ALL "${SD_DATADIR}")
ELSE()
SET(DEST_ALL "${DEST1}/${DEST2}")
SET(DEST_ALL "${SD_DATADIR}/${DATA_PATH}")
ENDIF()
# Install selected files into the data dir.
@ -1232,13 +1269,13 @@ MACRO(SD_INSTALL_DIRECTORIES)
# Register selected files in subdirs for run-time install/update
# at game startup (through filesetup.cpp services)
IF(FALSE AND IS_USER)
IF(IS_USER)
# Handle properly the "root" folder case.
IF(DATA_PATH STREQUAL "" OR DATA_PATH STREQUAL "/")
SET(DATA_PATH "")
IF(DATA_PATH STREQUAL "/")
SET(DEST_ALL "")
ELSE()
SET(DATA_PATH "${DATA_PATH}/")
SET(DEST_ALL "${DATA_PATH}/")
ENDIF()
# Execute xmlversion at install-time to do this registration job.
@ -1275,7 +1312,7 @@ MACRO(SD_INSTALL_DIRECTORIES)
FILE(GLOB_RECURSE FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}${POSTFIX} ${CMAKE_CURRENT_SOURCE_DIR}${POSTFIX}/\${GLOB_EXPRS})
FOREACH(FILE \${FILES})
IF(NOT \"\${FILE}\" MATCHES \"\\\\.svn\")
EXECUTE_PROCESS(COMMAND \"\${XMLVERSION_EXE}\" \"\${SD_DATADIR_ABS}/version.xml\" \"${DATA_PATH}\${FILE}\" \"${USER_PATH}/\${FILE}\" \"\${SD_DATADIR_ABS}\" RESULT_VARIABLE XMLVERSTATUS)
EXECUTE_PROCESS(COMMAND \"\${XMLVERSION_EXE}\" \"\${SD_DATADIR_ABS}/version.xml\" \"${DEST_ALL}\${FILE}\" \"${USER_PATH}/\${FILE}\" \"\${SD_DATADIR_ABS}\" RESULT_VARIABLE XMLVERSTATUS)
IF(XMLVERSTATUS)
MESSAGE(FATAL_ERROR \"Error: xmlversion failed\")
ENDIF(XMLVERSTATUS)
@ -1307,7 +1344,7 @@ MACRO(SD_INSTALL_DIRECTORIES)
FILE(GLOB_RECURSE FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}${POSTFIX} ${CMAKE_CURRENT_SOURCE_DIR}${POSTFIX}/\${GLOB_EXPRS})
FOREACH(FILE \${FILES})
IF(NOT \"\${FILE}\" MATCHES \"\\\\.svn\")
EXECUTE_PROCESS(COMMAND \"\${XMLVERSION_EXE}\" \"\${CUR_DESTDIR_CORR}\${SD_DATADIR_ABS}/version.xml\" \"${DATA_PATH}\${FILE}\" \"${USER_PATH}/\${FILE}\" \"\${CUR_DESTDIR_CORR}\${SD_DATADIR_ABS}\" RESULT_VARIABLE XMLVERSTATUS)
EXECUTE_PROCESS(COMMAND \"\${XMLVERSION_EXE}\" \"\${CUR_DESTDIR_CORR}\${SD_DATADIR_ABS}/version.xml\" \"${DEST_ALL}\${FILE}\" \"${USER_PATH}/\${FILE}\" \"\${CUR_DESTDIR_CORR}\${SD_DATADIR_ABS}\" RESULT_VARIABLE XMLVERSTATUS)
IF(XMLVERSTATUS)
MESSAGE(FATAL_ERROR \"Error: xmlversion failed\")
ENDIF(XMLVERSTATUS)
@ -1317,7 +1354,7 @@ MACRO(SD_INSTALL_DIRECTORIES)
ENDIF(WIN32)
ENDIF(FALSE AND IS_USER)
ENDIF(IS_USER)
ENDMACRO(SD_INSTALL_DIRECTORIES)