我用 QT creator 创建了一个项目,并且手动修改了 qmakefile。问题是,当我修改某些东西时,我需要两次构建项目,因为第一次我有一些链接后复制问题。编译输出第一次说,在编译结束时(成功结束):
cp ../../../configuration/options.xml ../../../bin cp /usr/lib/MyFramework/Debug/libMyFramework.so ../../../bin cp /usr/lib/MyFramework/Debug/libMyFrameworkRoutines.so ../../../bin
cp: omitting directory `../../../bin'
cp: cannot stat `cp': No such file or directory
cp: omitting directory `../../../bin'
cp: cannot stat `cp': No such file or directory
而第二次它编译正确,我没有这个问题。
我的makefile如下
# Variables used in the project
SOURCES_PATH = $$quote(../../../src/UpdateManager/sources)
HEADERS_PATH = $$quote(../../../src/UpdateManager/headers)
DESTINATION_PATH = $$quote(../../../bin)
# Project configuration
QT -= gui
TARGET = UpdateManager
TEMPLATE = lib
DEFINES += UPDATEMANAGER_LIBRARY
# Copying to destination folder
DESTDIR = $$DESTINATION_PATH
# Headers paths used in the project
INCLUDEPATH += $$HEADERS_PATH
# Source files
SOURCES += \
../../../src/UpdateManager/sources/options.cpp \
../../../src/UpdateManager/sources/consolelog.cpp \
../../../src/UpdateManager/sources/updatemanager.cpp
HEADERS += \
../../../src/UpdateManager/headers/options.h \
../../../src/UpdateManager/headers/consolelog.h \
../../../src/UpdateManager/headers/updatemanager.h
OTHER_FILES += \
../../../configuration/options.xml
unix:!symbian {
maemo5 {
target.path = /opt/usr/lib
} else {
target.path = /usr/lib
}
INSTALLS += target
}
### EXTERNAL LIBRARIES ###
# my framework
MY_FRAMEWORK_HEADERS_PATH = $$quote(/usr/include/MyFramerork/)
MY_FRAMEWORK_LIBRARY_PATH = $$quote(/usr/lib/MyFramerork)
MY_FRAMEWORK_ROUTINES_HEADERS_PATH = $$quote(/usr/include/MyFramerork/routines)
INCLUDEPATH += $$MY_FRAMEWORK_HEADERS_PATH
INCLUDEPATH += $$MY_FRAMEWORK_ROUTINES_HEADERS_PATH
LIBS += -L$$MY_FRAMEWORK_LIBRARY_PATH/Debug/ -lMyFramework
LIBS += -L$$MY_FRAMEWORK_LIBRARY_PATH/Debug/ -lMyFrameworkRoutines
# Copying needed files in out directory
unix{
EXTERNAL_FILES += \
../../../configuration/options.xml \
$$MY_FRAMEWORK_LIBRARY_PATH/Debug/libMyFramework.so \
$$MY_FRAMEWORK_LIBRARY_PATH/Debug/libMyFrameworkRoutines.so
for(FILE,EXTERNAL_FILES){
QMAKE_POST_LINK += $$quote(cp $${FILE} $${DESTDIR})
}
}
# Boost
LIBS += -lboost_thread
我认为复制问题与此部分有关
# Copying needed files in out directory
unix{
EXTERNAL_FILES += \
../../../configuration/options.xml \
$$MY_FRAMEWORK_LIBRARY_PATH/Debug/libMyFramework.so \
$$MY_FRAMEWORK_LIBRARY_PATH/Debug/libMyFrameworkRoutines.so
for(FILE,EXTERNAL_FILES){
QMAKE_POST_LINK += $$quote(cp $${FILE} $${DESTDIR})
}
}
因为在本节中,我复制了在输出中给我带来问题的文件。所有目录都存在。那么我在哪里错了,我该如何纠正它以便在第一个构建步骤中正确复制文件?
提前感谢您的回复。