[CMake] How to properly use AUTOGEN_BUILD_DIR property?
Volker Enderlein
volker.enderlein at ifm-chemnitz.de
Wed Jul 19 05:41:51 EDT 2017
Hi,
our project contains lots of autogenerated Qt files and when reading the
3.9 Release notes I was very excited about the new AUTOGEN_BUILD_DIR
property to speed up the build times (for constantly bulding debug and
release versions in case nothing has changed).
But it seems I cannot get it to work properly with MSVC 14 2015 and a
config dependent AUTOGEN_BUILD_DIR.
My CMakeLists.txt basically looks the following way:
cmake_minimum_required (VERSION 3.9)
project(AUTOGEN_Test)
find_package(Qt5 COMPONENTS Core Gui Widgets REQUIRED)
set(HEADERS file.h main.h)
set(SOURCES file.cpp main.cpp)
set(CMAKE_AUTOMOC TRUE)
set(CMAKE_AUTOUIC TRUE)
set(CMAKE_AUTORCC TRUE)
add_executable(TargetName ${HEADERS} ${SOURCES})
set_target_properties(TargetName PROPERTIES AUTOGEN_BUILD_DIR
${CMAKE_CURRENT_BINARY_DIR}/TargetName_autogen_$<$<CONFIG:Debug>:Debug>$<$<NOT:$<CONFIG:Debug>>:Release>)
target_link_libraries(TargetName
Qt5:Qt5Core
Qt5:Qt5Gui
Qt5:Qt5Widgets
)
The resulting error messages are as follows:
CMake Error at C:/Temp/AUTOGEN_Test/CMakeLists.txt:14 (add_executable):
Cannot find source file:
C:/Temp/AUTOGEN_Test_build/TargetName_autogen_Debug/mocs_compilation.cpp
Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm
.hpp.hxx .in .txx
and respectively for the Release version.
What am I doing wrong?Thanks in advance,
Cheers, Volker
--
More information about the CMake
mailing list