Include what you use
-
Hello everybody,
I'm fresh new to QT.
I want to compile my first project (an example that I found on the internet) with QT, but I've got an error:CMake Error at CMakeLists.txt:20 (message): Could not find the program include-what-you-use
How making this "include what you use" work in QT ?
Thanks a lot in advance. -
Hello everybody,
I'm fresh new to QT.
I want to compile my first project (an example that I found on the internet) with QT, but I've got an error:CMake Error at CMakeLists.txt:20 (message): Could not find the program include-what-you-use
How making this "include what you use" work in QT ?
Thanks a lot in advance.@Pascal06 said in Include what you use:
How making this "include what you use" work in QT ?
Why do you want to use it? How did you compile include-what-you-use and is it in your PATH so cmake can find it?
-
@Pascal06 said in Include what you use:
How making this "include what you use" work in QT ?
Why do you want to use it? How did you compile include-what-you-use and is it in your PATH so cmake can find it?
@Christian-Ehrlicher
Hello, thanks a lot for your reply.
I don't know why I have to use this thing, it was in the project:project(xclm) cmake_minimum_required(VERSION 3.3 FATAL_ERROR) set(CMAKE_CXX_STANDARD 11) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) # add single headers to project structure FILE(GLOB_RECURSE HeaderFiles "*.h") add_custom_target(headers SOURCES ${HeaderFiles}) include_directories(.) find_package(Boost 1.57.0 COMPONENTS system program_options filesystem REQUIRED) if(Boost_FOUND) find_program(iwyu_path NAMES include-what-you-use iwyu) if(NOT iwyu_path) message(FATAL_ERROR "Could not find the program include-what-you-use") endif() set(iwyu_path_and_options ${iwyu_path} -Xiwyu --check_also) aux_source_directory(. SRC_LIST) aux_source_directory(hashes SRC_LIST) aux_source_directory(runner SRC_LIST) aux_source_directory(version SRC_LIST) add_executable(${PROJECT_NAME} ${SRC_LIST}) target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES}) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_INCLUDE_WHAT_YOU_USE ${iwyu_path}) else() message(FATAL_ERROR "boost library not found.") endif()
Be indulgent, I'm very newbie to QT...
Thanks a lot for your comprehsion -
@Christian-Ehrlicher
Hello, thanks a lot for your reply.
I don't know why I have to use this thing, it was in the project:project(xclm) cmake_minimum_required(VERSION 3.3 FATAL_ERROR) set(CMAKE_CXX_STANDARD 11) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) # add single headers to project structure FILE(GLOB_RECURSE HeaderFiles "*.h") add_custom_target(headers SOURCES ${HeaderFiles}) include_directories(.) find_package(Boost 1.57.0 COMPONENTS system program_options filesystem REQUIRED) if(Boost_FOUND) find_program(iwyu_path NAMES include-what-you-use iwyu) if(NOT iwyu_path) message(FATAL_ERROR "Could not find the program include-what-you-use") endif() set(iwyu_path_and_options ${iwyu_path} -Xiwyu --check_also) aux_source_directory(. SRC_LIST) aux_source_directory(hashes SRC_LIST) aux_source_directory(runner SRC_LIST) aux_source_directory(version SRC_LIST) add_executable(${PROJECT_NAME} ${SRC_LIST}) target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES}) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_INCLUDE_WHAT_YOU_USE ${iwyu_path}) else() message(FATAL_ERROR "boost library not found.") endif()
Be indulgent, I'm very newbie to QT...
Thanks a lot for your comprehsionIf you don't need include-what-you-use then remove it from your CMakeLists.txt. Nothing Qt specific.
-
If you don't need include-what-you-use then remove it from your CMakeLists.txt. Nothing Qt specific.
@Christian-Ehrlicher
Hello,
indeed, I commented lines related to iwyu in CMakeList and now it compile.
Sorry my question was stupid.
Thanks a lot for your help.Pascal
-