1
0
Fork 0

Handle CMake policy 0071 correctly

This commit is contained in:
James Turner 2018-04-30 11:23:53 +01:00 committed by James Turner
parent 0762af76c2
commit cf5e2b39f1
3 changed files with 20 additions and 0 deletions

View file

@ -14,6 +14,14 @@ if(COMMAND cmake_policy)
if(POLICY CMP0042) if(POLICY CMP0042)
cmake_policy(SET CMP0042 NEW) cmake_policy(SET CMP0042 NEW)
endif() endif()
# AUTOMOC/AUTOUIC on generated files policy. Since we only
# generate resource files with fgrcc which don't use Qt,
# we set those files source property. See the help for this
# policy for more info
if(POLICY CMP0071)
cmake_policy(SET CMP0071 NEW)
endif()
endif() endif()
message("CMAKE Build type: ${CMAKE_BUILD_TYPE}") message("CMAKE Build type: ${CMAKE_BUILD_TYPE}")

View file

@ -9,6 +9,13 @@ function(setup_fgfs_embedded_resources)
set_property(GLOBAL APPEND PROPERTY EMBEDDED_RESOURCE_SOURCES ${SOURCES}) set_property(GLOBAL APPEND PROPERTY EMBEDDED_RESOURCE_SOURCES ${SOURCES})
set_property(GLOBAL APPEND PROPERTY EMBEDDED_RESOURCE_HEADERS ${HEADERS}) set_property(GLOBAL APPEND PROPERTY EMBEDDED_RESOURCE_HEADERS ${HEADERS})
# set the flag for CMake polocy 00071, ensure Qt AUTOfoo don't process
# generated files
foreach(sourcefile IN LISTS ${SOURCES} ${HEADERS})
set_property(SOURCE ${sourcefile} PROPERTY SKIP_AUTOMOC ON)
set_property(SOURCE ${sourcefile} PROPERTY SKIP_AUTOUIC ON)
endforeach()
# On Windows, make sure fgrcc can be run (it needs third-party libraries) # On Windows, make sure fgrcc can be run (it needs third-party libraries)
if(MSVC) if(MSVC)
if(MSVC_3RDPARTY_ROOT AND MSVC_3RDPARTY_DIR) if(MSVC_3RDPARTY_ROOT AND MSVC_3RDPARTY_DIR)

View file

@ -2,6 +2,11 @@ cmake_minimum_required(VERSION 3.0)
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED YES) set(CMAKE_CXX_STANDARD_REQUIRED YES)
# AUTOMOC/AUTOUIC on generated files policy.
if(POLICY CMP0071)
cmake_policy(SET CMP0071 NEW)
endif()
include(GNUInstallDirs) include(GNUInstallDirs)
project(FGQCanvas) project(FGQCanvas)