--- mscore/mscore/CMakeLists.txt.orig	2012-03-13 22:32:27.000000000 +0900
+++ mscore/mscore/CMakeLists.txt	2012-06-09 20:57:43.000000000 +0900
@@ -32,7 +32,7 @@
 
 SET_SOURCE_FILES_PROPERTIES(revision.h PROPERTIES GENERATED TRUE)
 
-include_directories(
+include_directories(BEFORE
       ${CMAKE_CURRENT_BINARY_DIR}
       ${PROJECT_SOURCE_DIR}
       ${PROJECT_SOURCE_DIR}/scriptdebug
@@ -160,9 +160,6 @@
 
 # gold does not use indirect shared libraries for symbol resolution, Linux only
 if (NOT MINGW AND NOT APPLE)
-      if(USE_JACK)
-        target_link_libraries(mscore dl)  
-      endif(USE_JACK)
       target_link_libraries(mscore rt)
 endif (NOT MINGW AND NOT APPLE)
 
@@ -264,8 +261,8 @@
       ${QT_LIBRARIES}
       ${QT_QTSCRIPT_LIBRARY_RELEASE}
       ${QT_QTSCRIPT_TOOLS_LIBRARY_RELEASE}
-      ${ALSA_LIB}
       ${PORTAUDIO_LIB}
+      ${ALSA_LIB}
       al
       awl
       bww
@@ -277,7 +274,7 @@
       )
 
    if (HAS_AUDIOFILE)
-       target_link_libraries(mscore sndfile)
+       target_link_libraries(mscore %%LOCALBASE%%/lib/libsndfile.so)
    endif (HAS_AUDIOFILE)
 
    if (APPLE)
@@ -343,9 +340,9 @@
       ${ui_headers}
       genft.cpp
       )
-   target_link_libraries(genft al ${QT_LIBRARIES} -lfreetype )
+   target_link_libraries(genft al ${QT_LIBRARIES} %%LOCALBASE%%/lib/libfreetype.so )
    set_target_properties(genft
-      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -I/usr/include/freetype2"
+      PROPERTIES COMPILE_FLAGS "-include ${PROJECT_BINARY_DIR}/all.h -I%%LOCALBASE%%/include/freetype2"
       )
 endif (NOT MINGW AND NOT APPLE)
 
