mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-04 18:06:22 +03:00
0029542: Coding - CMake compiler warnings in Inspector
Avoid using CMAKE_AUTOMOC, collect header files with Q_OBJECT iterating through a project files.
This commit is contained in:
parent
a468bca87c
commit
410dd2c903
@ -23,11 +23,6 @@ endif()
|
|||||||
|
|
||||||
SET (RCC_FILES)
|
SET (RCC_FILES)
|
||||||
foreach (OCCT_PACKAGE ${USED_PACKAGES})
|
foreach (OCCT_PACKAGE ${USED_PACKAGES})
|
||||||
file (STRINGS "${CMAKE_SOURCE_DIR}/${PACKAGE_PREFIX_DIR}/${OCCT_PACKAGE}/FILES" SOURCE_FILES_C REGEX ".+[.]c")
|
|
||||||
|
|
||||||
#message("Sources are ${SOURCE_FILES_C}")
|
|
||||||
FIND_AND_WRAP_MOC_FILES("${SOURCE_FILES_C}")
|
|
||||||
|
|
||||||
#message("Dir is ${CMAKE_SOURCE_DIR}/${PACKAGE_PREFIX_DIR}/${OCCT_PACKAGE}/${OCCT_PACKAGE}.qrc")
|
#message("Dir is ${CMAKE_SOURCE_DIR}/${PACKAGE_PREFIX_DIR}/${OCCT_PACKAGE}/${OCCT_PACKAGE}.qrc")
|
||||||
FIND_AND_WRAP_RESOURCE_FILE("${CMAKE_SOURCE_DIR}/${PACKAGE_PREFIX_DIR}/${OCCT_PACKAGE}/${OCCT_PACKAGE}.qrc" RCC_FILES)
|
FIND_AND_WRAP_RESOURCE_FILE("${CMAKE_SOURCE_DIR}/${PACKAGE_PREFIX_DIR}/${OCCT_PACKAGE}/${OCCT_PACKAGE}.qrc" RCC_FILES)
|
||||||
endforeach()
|
endforeach()
|
||||||
@ -177,13 +172,16 @@ if (NOT SINGLE_GENERATOR)
|
|||||||
OCCT_INSERT_CODE_FOR_TARGET ()
|
OCCT_INSERT_CODE_FOR_TARGET ()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
FIND_AND_WRAP_MOC_FILES("${USED_INCFILES}" "${PROJECT_NAME}_MOC_FILES")
|
||||||
|
#message("MOC files: ${${PROJECT_NAME}_MOC_FILES}")
|
||||||
|
|
||||||
if ("${PROJECT_NAME}" STREQUAL TInspectorEXE)
|
if ("${PROJECT_NAME}" STREQUAL TInspectorEXE)
|
||||||
add_executable (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE} ${RCC_FILES})
|
add_executable (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE} ${RCC_FILES} ${${PROJECT_NAME}_MOC_FILES})
|
||||||
|
|
||||||
install (TARGETS ${PROJECT_NAME}
|
install (TARGETS ${PROJECT_NAME}
|
||||||
DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}")
|
DESTINATION "${INSTALL_DIR_BIN}\${OCCT_INSTALL_BIN_LETTER}")
|
||||||
else()
|
else()
|
||||||
add_library (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE} ${RCC_FILES})
|
add_library (${PROJECT_NAME} ${USED_SRCFILES} ${USED_INCFILES} ${USED_RCFILE} ${RCC_FILES} ${${PROJECT_NAME}_MOC_FILES})
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
install (FILES ${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin\${OCCT_INSTALL_BIN_LETTER}/${PROJECT_NAME}.pdb
|
install (FILES ${CMAKE_BINARY_DIR}/${OS_WITH_BIT}/${COMPILER}/bin\${OCCT_INSTALL_BIN_LETTER}/${PROJECT_NAME}.pdb
|
||||||
|
@ -37,20 +37,21 @@ macro (FIND_QT_PACKAGE PROJECT_LIBRARIES_DEBUG PROJECT_LIBRARIES_RELEASE PROJECT
|
|||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
|
||||||
macro (FIND_AND_WRAP_MOC_FILES SOURCE_FILES)
|
macro (FIND_AND_WRAP_MOC_FILES HEADER_FILES GENERATED_MOC_FILES)
|
||||||
|
set (GENERATED_MOC_FILES "")
|
||||||
SET(CMAKE_AUTOMOC ON)
|
foreach (FILE ${HEADER_FILES})
|
||||||
|
# processing only files where Q_OBJECT exists
|
||||||
foreach (FILE ${SOURCE_FILES})
|
file(STRINGS "${FILE}" LINES REGEX "Q_OBJECT")
|
||||||
set (src_files ${src_files} ${FILE})
|
if(LINES)
|
||||||
unset (MOC_FILE)
|
unset (MOC_FILE)
|
||||||
if (${Qt5_FOUND})
|
if (${Qt5_FOUND})
|
||||||
qt5_wrap_cpp(MOC_FILE ${FILE})
|
qt5_wrap_cpp(MOC_FILE ${FILE})
|
||||||
else()
|
else()
|
||||||
qt4_wrap_cpp(MOC_FILE ${FILE})
|
qt4_wrap_cpp(MOC_FILE ${FILE})
|
||||||
endif()
|
endif()
|
||||||
#message (STATUS "... Info: next MOC file ${MOC_FILE}")
|
#message (STATUS "... Info: next MOC file ${MOC_FILE}")
|
||||||
|
list(APPEND ${GENERATED_MOC_FILES} ${MOC_FILE})
|
||||||
|
endif(LINES)
|
||||||
endforeach (FILE)
|
endforeach (FILE)
|
||||||
|
|
||||||
endmacro()
|
endmacro()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user