Search code examples
c++qtcmakemocqtimer

CMake with Qt: moc creates .cpp_parameters ending


I am trying to integrate Qt in my project, especially QTimer.

Therefore, I have been trying to generate the moc files with cmake:

set(MOC_FILES
    ${CMAKE_CURRENT_SOURCE_DIR}/../headerfile.h
)
set(HEADER_FILES
    ...
    ${MOC_FILES}
)
...

ivw_qt_wrap_cpp(MOC_FILES ${MOC_FILES})

#--------------------------------------------------------------------
# Create module
ivw_create_module(${SOURCE_FILES} ${SHADER_FILES} ${MOC_FILES} ${HEADER_FILES})

As a result it creates a file moc_headerfile.cpp_parameters, but the file should be moc_volumeraycaster.cpp.

The content of the file is this:

-DINVIWO_ALL_DYN_LINK
-DGLM_SHARED_BUILD
-DWIN32
-o
C:/../moc_headerfile.cpp
C:/..headerfile.h

Any ideas?


Solution

  • You shouldn't use the same variable as input and output for qt_wrap_cpp.

    You could get rid of this using AUTOMOC:

    set(SOURCE_FILES
        ...
        ${CMAKE_CURRENT_SOURCE_DIR}/../headerfile.h
    )
    ...
    
    set(CMAKE_AUTOMOC ON)
    
    #--------------------------------------------------------------------
    # Create module
    ivw_create_module(${SOURCE_FILES} ${SHADER_FILES} ${HEADER_FILES})