# HG changeset patch # User sheepluva # Date 1420553794 -3600 # Node ID d48a14222956155a35855171f6464ac23e5a40f6 # Parent 56e401fb45eab6436bef9a5094fceed4bb6da666# Parent edfe052bebe64c4aee06826d34e7e928665e9d7b Merge pull request #29 from LocutusOfBorg/bad-fix-segfault Fix for segfault when BUILD_ENGINE_C=ON and FONTS_DIR is provided, by Locutus and unC0Rr diff -r 56e401fb45ea -r d48a14222956 hedgewars/CMakeLists.txt --- a/hedgewars/CMakeLists.txt Mon Jan 05 16:29:27 2015 +0100 +++ b/hedgewars/CMakeLists.txt Tue Jan 06 15:16:34 2015 +0100 @@ -21,12 +21,16 @@ endif(UNIX) # convert list into pascal array -list(LENGTH FONTS_DIRS ndirs) -set(FONTS_DIRS_ARRAY "array [0..${ndirs}] of PChar = (") -foreach(fontdir ${FONTS_DIRS}) - set(FONTS_DIRS_ARRAY "${FONTS_DIRS_ARRAY}\n'${fontdir}',") -endforeach(fontdir) -set(FONTS_DIRS_ARRAY "${FONTS_DIRS_ARRAY}\nnil);\n") +if(FONTS_DIRS) + list(LENGTH FONTS_DIRS ndirs) + set(FONTS_DIRS_ARRAY "array [0..${ndirs}] of PChar = (") + foreach(fontdir ${FONTS_DIRS}) + set(FONTS_DIRS_ARRAY "${FONTS_DIRS_ARRAY}\n_P'${fontdir}',") + endforeach(fontdir) + set(FONTS_DIRS_ARRAY "${FONTS_DIRS_ARRAY}\nnil);\n") +else(FONTS_DIRS) + set(FONTS_DIRS_ARRAY "array [0..1] of PChar = (nil, nil);") +endif(FONTS_DIRS) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.inc.in ${CMAKE_CURRENT_BINARY_DIR}/config.inc) include_directories(${CMAKE_CURRENT_BINARY_DIR}) diff -r 56e401fb45ea -r d48a14222956 hedgewars/config.inc.in --- a/hedgewars/config.inc.in Mon Jan 05 16:29:27 2015 +0100 +++ b/hedgewars/config.inc.in Tue Jan 06 15:16:34 2015 +0100 @@ -26,8 +26,4 @@ cRevisionString = '${HEDGEWARS_REVISION}'; cHashString = '${HEDGEWARS_HASH}'; cDefaultPathPrefix = '${HEDGEWARS_FULL_DATADIR}/Data'; -{$IFDEF PAS2C} - cFontsPaths: array[0..1] of PChar = (nil, nil); -{$ELSE} cFontsPaths: ${FONTS_DIRS_ARRAY} -{$ENDIF} diff -r 56e401fb45ea -r d48a14222956 project_files/hwc/CMakeLists.txt --- a/project_files/hwc/CMakeLists.txt Mon Jan 05 16:29:27 2015 +0100 +++ b/project_files/hwc/CMakeLists.txt Tue Jan 06 15:16:34 2015 +0100 @@ -16,6 +16,18 @@ include_directories(${SDL_INCLUDE_DIR}) add_subdirectory(rtl) +# convert list into pascal array +if(FONTS_DIRS) + list(LENGTH FONTS_DIRS ndirs) + set(FONTS_DIRS_ARRAY "array [0..${ndirs}] of PChar = (") + foreach(fontdir ${FONTS_DIRS}) + set(FONTS_DIRS_ARRAY "${FONTS_DIRS_ARRAY}\n_P'${fontdir}',") + endforeach(fontdir) + set(FONTS_DIRS_ARRAY "${FONTS_DIRS_ARRAY}\nnil);\n") +else(FONTS_DIRS) + set(FONTS_DIRS_ARRAY "array [0..1] of PChar = (nil, nil);") +endif(FONTS_DIRS) + configure_file(${CMAKE_SOURCE_DIR}/hedgewars/config.inc.in ${CMAKE_CURRENT_BINARY_DIR}/config.inc) #get the list of pas files that are going to be converted and compiled