How to properly use AUTOGEN_BUILD_DIR property?

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

How to properly use AUTOGEN_BUILD_DIR property?

Volker Enderlein
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

--

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake
Loading...