CMake fix (quite weird)

OS X script to fix some new bug about libs...
fixed test for trees
This commit is contained in:
Eduardo San Martin Morote 2014-06-13 18:45:53 +02:00
parent dd1b381029
commit eb858551ae
3 changed files with 25 additions and 2 deletions

View File

@ -127,7 +127,7 @@ file(GLOB_RECURSE all_obj ${OBJ_FILES}/*.o)
list(REMOVE_ITEM all_obj ${OBJ_FILES}/main.cpp.o)
#STRING(REPLACE ; " " all_obj "${all_obj}")
file(GLOB_RECURSE all_tests ${PROJECT_SOURCE_DIR}/tests/*.cpp)
#message("tests: ${all_tests}")
#message("tests: ${all_obj}")
foreach(t ${all_tests})
GET_FILENAME_COMPONENT(f_base ${t} NAME_WE)

23
osx-fix.sh Executable file
View File

@ -0,0 +1,23 @@
#!/bin/bash
# fix quand il ne trouve pas certaines dylib. Cela peut arriver...
# $1 = executable
while [[ ! "$1" = "" ]]; do
EXE="$1"
echo "Checking for $EXE..."
BAD_LIBS=$(otool -L "$EXE" | cut -d " " -f 1 | grep "@executable")
for i in $BAD_LIBS; do
echo "Fixing $i for $EXE..."
NEW_LIB=`locate $(basename $i) | tail -n1`
echo "Found $NEW_LIB for $EXE, patching..."
if [[ "$?" = 0 ]]; then
install_name_tool -change "$i" "$NEW_LIB" "$EXE" || echo "ERROR: cannot change $EXE"
else
echo "ERROR: couldn't locate '$i' for $EXE"
fi
done
shift;
done

View File

@ -5,7 +5,7 @@ int main(void)
{
Tree tree;
tree.generate();
tree.generate(1);
debug("size: %d, height: %d", tree.getSize(), tree.getHeight());