George W
George W

Reputation: 13

CMake find_package messed up the include paths

I using CMake 3.5.1 on Debian 7 for my project. Here is the code in my CMakeLists.txt

find_package(Qt5 REQUIRED COMPONENTS Core)
message(STATUS ${Qt5Core_INCLUDE_DIRS})

But the print out of ${Qt5Core_INCLUDE_DIRS} is /usr/include/x86_64-linux-gnu/qt5//usr/include/x86_64-linux-gnu/qt5/QtCore/usr/lib/x86_64-linux-gnu/qt5//mkspecs/linux-g++-64 which has no space between the paths.

What's wrong with CMake or is anything wrong in my CMakeLists.txt? How can I fix this?

thank you!

Upvotes: 0

Views: 544

Answers (1)

arrowd
arrowd

Reputation: 34411

Qt5Core_INCLUDE_DIRS variable is a list, that is a string delimited with ;. When printing such strings, CMake omits delimiter and concatenates elements.

Use list and foreach commands to work with list elements.

Upvotes: 1

Related Questions