You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
72 lines
2.5 KiB
72 lines
2.5 KiB
7 years ago
|
# Test moc include patterns
|
||
7 years ago
|
include_directories("../MocInclude")
|
||
7 years ago
|
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||
|
|
||
|
# Generate .moc file externally and enabled SKIP_AUTOMOC on the file
|
||
|
qtx_generate_moc(
|
||
7 years ago
|
${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/SObjA.hpp
|
||
7 years ago
|
${CMAKE_CURRENT_BINARY_DIR}/SObjA.moc)
|
||
7 years ago
|
set_property(SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/SObjA.cpp PROPERTY SKIP_AUTOMOC ON)
|
||
7 years ago
|
|
||
|
# Generate .moc file externally from generated source file
|
||
|
# and enabled SKIP_AUTOMOC on the source file
|
||
|
add_custom_command(
|
||
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/SObjB.hpp
|
||
|
COMMAND ${CMAKE_COMMAND} -E copy
|
||
7 years ago
|
${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/SObjB.hpp.in
|
||
7 years ago
|
${CMAKE_CURRENT_BINARY_DIR}/SObjB.hpp)
|
||
|
add_custom_command(
|
||
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/SObjB.cpp
|
||
|
COMMAND ${CMAKE_COMMAND} -E copy
|
||
7 years ago
|
${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/SObjB.cpp.in
|
||
7 years ago
|
${CMAKE_CURRENT_BINARY_DIR}/SObjB.cpp)
|
||
|
qtx_generate_moc(
|
||
|
${CMAKE_CURRENT_BINARY_DIR}/SObjB.hpp
|
||
|
${CMAKE_CURRENT_BINARY_DIR}/SObjB.moc)
|
||
|
set_property(SOURCE ${CMAKE_CURRENT_BINARY_DIR}/SObjB.cpp PROPERTY SKIP_AUTOMOC ON)
|
||
|
|
||
|
# Generate moc file externally and enabled SKIP_AUTOMOC on the header
|
||
|
qtx_generate_moc(
|
||
7 years ago
|
${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/SObjCExtra.hpp
|
||
7 years ago
|
${CMAKE_CURRENT_BINARY_DIR}/SObjCExtra_extMoc.cpp)
|
||
|
set_property(
|
||
7 years ago
|
SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/SObjCExtra.hpp
|
||
7 years ago
|
PROPERTY SKIP_AUTOMOC ON)
|
||
|
# Custom target to depend on
|
||
|
set(SOBJC_MOC ${CMAKE_CURRENT_BINARY_DIR}/moc_SObjCExtra.cpp)
|
||
|
add_custom_target("${MOC_INCLUDE_NAME}_SOBJC"
|
||
|
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/SObjCExtra_extMoc.cpp
|
||
|
BYPRODUCTS ${SOBJC_MOC}
|
||
|
COMMAND ${CMAKE_COMMAND} -E copy
|
||
7 years ago
|
${CMAKE_CURRENT_SOURCE_DIR}/../MocInclude/SObjCExtra.moc.in
|
||
7 years ago
|
${SOBJC_MOC})
|
||
|
|
||
|
# MOC_INCLUDE_NAME must be defined by the includer
|
||
|
add_executable(${MOC_INCLUDE_NAME}
|
||
|
# Common sources
|
||
7 years ago
|
../MocInclude/ObjA.cpp
|
||
|
../MocInclude/ObjB.cpp
|
||
7 years ago
|
|
||
7 years ago
|
../MocInclude/LObjA.cpp
|
||
|
../MocInclude/LObjB.cpp
|
||
7 years ago
|
|
||
7 years ago
|
../MocInclude/EObjA.cpp
|
||
|
../MocInclude/EObjAExtra.cpp
|
||
|
../MocInclude/EObjB.cpp
|
||
|
../MocInclude/subExtra/EObjBExtra.cpp
|
||
7 years ago
|
|
||
7 years ago
|
../MocInclude/SObjA.cpp
|
||
7 years ago
|
${CMAKE_CURRENT_BINARY_DIR}/SObjA.moc
|
||
|
${CMAKE_CURRENT_BINARY_DIR}/SObjB.cpp
|
||
|
${CMAKE_CURRENT_BINARY_DIR}/SObjB.moc
|
||
7 years ago
|
../MocInclude/SObjC.cpp
|
||
|
../MocInclude/SObjCExtra.hpp
|
||
|
../MocInclude/SObjCExtra.cpp
|
||
7 years ago
|
|
||
7 years ago
|
../MocInclude/subGlobal/GObj.cpp
|
||
7 years ago
|
main.cpp
|
||
|
)
|
||
|
add_dependencies(${MOC_INCLUDE_NAME} "${MOC_INCLUDE_NAME}_SOBJC")
|
||
|
target_link_libraries(${MOC_INCLUDE_NAME} ${QT_LIBRARIES})
|
||
|
set_target_properties(${MOC_INCLUDE_NAME} PROPERTIES AUTOMOC ON)
|