[CMake] AUTOUIC generated headers not found by lib that uses lib with headers

Jim Carroll jim at maplesong.com
Mon Jul 30 13:48:38 EDT 2018


I have a project that I'm updating from Cmake 3.5 to 3.12.

In the project, I have UI libraries that use other libraries, both of which
use Qt 5.6.
The lowest-level library uses AUTOUIC and I see the headers are generated
in the new lib_autogen/include_BUILD_CONFIG directory.

When my higher level library tries to use the lower level library, I get
the error that it can't find the auto-generated headers. It only seems to
have trouble finding about six of two dozen ui_***.h files.

How can I get my lower level libraries to include the generated header
files so they're available to the higher level library that's using it?

I'm using
cmake 3.12
Qt 5.6
Visual Studio 2015

I tried creating a work-around where in the CMakeLists.txt of my lowest
level directory I add

# CMake 10+ has a bug where automoc header files aren't found
SET(COMPONENTS_UIC_HDRS_DIR
"${CMAKE_CURRENT_BINARY_DIR}/ComponentsLib_autogen/include_${
*CMAKE_BUILD_TYPE*}")
message("** COMPONENTS AUTOUIC autogen dir: ${COMPONENTS_UIC_HDRS_DIR}")
*target_include_directories*(ComponentsLib INTERFACE
${COMPONENTS_UIC_HDRS_DIR})

but of course the CMAKE_BUILD_TYPE isn't available to CMake at this time.
I'd have to move the headers into a place common to the various
(Debug/Release) configurations or something.

Thanks!
-Jim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180730/7f1f4732/attachment.html>


More information about the CMake mailing list