[CMake] Building a main.cpp containing a QObject subclass

Alexander Neundorf a.neundorf-work at gmx.net
Mon Oct 31 16:08:51 EDT 2011


On Monday 31 October 2011, Laszlo Papp wrote:
...
> [code]
> cmake_minimum_required(VERSION 2.8)
> find_package(Automoc4 REQUIRED)
> include_directories(${CMAKE_CURRENT_SOURCE_DIR}
> ${CMAKE_CURRENT_BINARY_DIR}) find_package(Qt4)
> include_directories(
>     ${QT_INCLUDES}
>     ${CMAKE_CURRENT_BINARY_DIR}
>     ${CMAKE_CURRENT_SOURCE_DIR}
> )
> set(test_SRCS
>     main.cpp
> )
> automoc4_add_executable(test ${test_SRCS})
> target_link_libraries(test ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY})
> [/code]
> 
> Also,"set(CMAKE_AUTOMOC ON)" aborts the build:
> terminate called after throwing an instance of 'std::logic_error'
>   what():  basic_string::_S_construct null not valid
> Aborted

Please add a bug in the cmake bug tracker for that: 
http://public.kitware.com/Bug/

Thanks
Alex


More information about the CMake mailing list