[CMake] change the moc_file directory
Sören Freudiger
muffmolch at gmx.de
Mon Aug 22 11:36:36 EDT 2005
Is it possible to change the directory the moc files will be generated in?
Right now I have following structure (just an example):
D:/test/source/function/presentation/QTHeader.h
D:/test/source/function/presentation/CMakeLists.txt
D:/test/bin/CMakeLists.txt
This is only a tiny part of the big structure... We have any other
subdirectorys...
------
D:/test/bin/CMakeLists.txt:
"
SET(SOURCE_ROOT ../source)
INCLUDE(${SOURCE_ROOT}/function/presentation/CMakeLists.txt)
FOREACH(FILE ${TEMP_FILES})
SET(ALL_SOURCES ${ALL_SOURCES} ${FILE})
ENDFOREACH(FILE)
...
IF(QT_FOUND)
OPTION(A_FOUND_QT " " YES)
INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR} ${QT_INCLUDE_PATH} )
LINK_LIBRARIES ( ${QT_QT_LIBRARY} )
ADD_DEFINITIONS( ${QT_DEFINITIONS})
INCLUDE_DIRECTORIES( ${QT_INCLUDE_DIR} )
ENDIF(QT_FOUND)
ADD_EXECUTABLE(lbmexe
main.cpp
${ALL_SOURCES}
${ALL_MOC_FILES}
)
"
------------------------
D:/test/source/function/presentation/CMakeLists.txt:
"...
SET(CURRENT_DIR ${SOURCE_ROOT}/function/presentation)
FILE(GLOB HEADER_FILES ${CURRENT_DIR}/*.h )
FILE(GLOB CPP_FILES ${CURRENT_DIR}/*.cpp)
SET(TEMP_FILES ${HEADER_FILES} ${CPP_FILES})
INCLUDE(${CMAKE_ROOT}/Modules/FindQt.cmake)
IF(QT_FOUND)
SET(MOC_CLASSES
${CURRENT_DIR}/QPoElement2D.h
${CURRENT_DIR}/QDiagram2D.h
)
QT_WRAP_CPP(${PROJECT_NAME} ALL_MOC_FILES ${MOC_CLASSES})
ENDIF(QT_FOUND)
"
The problem is the comiling of the source code (e.g. windows MS VS 2005)
Error:
"
moc:
D:/temp/bin4/../source/basics/utilities/presentation/QFunction2DWidget.h: No
such file
"
Questions:
1. How can I set the correct path in the rules
(moc:
D:/test/source/source/basics/utilities/presentation/QFunction2DWidget.h:?
2. In general, can I define the moc_file output directory?
Thanks,
Soeren
More information about the CMake
mailing list