i'm trying cmake project set on os x. i've got compiling i'm having little trouble getting qt5 working.
when try compile, get:
fatal error: 'qtcore/qdir' file not found fatal error: 'qtcore/qdate' file not found
when check out code, ide has both qtcore , qtwidgets highlighted in red, indicating weren't found.
do of have idea i'm missing?
my cmakelists.txt follows:
cmake_minimum_required(version 3.3) project(minilogbook) subdirs(sources headers lib other) #for basic project, should need edit these variables #base qt directory set(qt_path "/users/rwardrup/qt") #build output path of qt creator project set(qt_bin "./ml_debug") #qt version used, e.g. found in ${qt_path} set(qt_version "5.7") #libraries link set(qt_libraries qt5::core qt5::widgets qt5::gui) #libraries required. same above minus '::'. find_package() called on these set(qt_libraries_required qt5core qt5widgets qt5gui) ################################################################# #pull needed header files generated qt first set(qt_generated qtgenerated) add_custom_target(${qt_generated}) #get header files in directory file(glob qt_gen_headers ${qt_bin}/*.h) #copy them project dir foreach(qt_gen_headers ${qt_gen_headers}) add_custom_command(target ${qt_generated} pre_build command ${cmake_command} -e copy_if_different ${qt_gen_headers} ${cmake_source_dir}) endforeach() #build tool paths set(cmake_cxx_compiler "/usr/bin/g++") set(cmake_ar "/usr/bin/ar") set(cmake_linker "/usr/bin/g++") #find packages foreach(qt_libraries_required ${qt_libraries_required}) find_package( ${qt_libraries_required} required ) endforeach() file(glob qt_cpp_generated ${qt_bin}/*.cpp) set(sources sources/main.cpp sources/mainwindow.cpp headers/mainwindow.h ${qt_gen_headers} ${qt_cpp_generated}) set(boost_use_static_libs off) set(boost_use_multithreaded on) set(boost_use_static_runtime off) find_package(boost 1.59.0 components filesystem) if(boost_found) include_directories(${boost_include_dirs}) add_executable(minilogbook ${sources}) add_dependencies(${project_name} ${qt_generated}) target_link_libraries(${project_name} ${qt_libraries} ${boost_libraries}) endif()
your foreach
loops bugged.
in both cases overwriting list of values loop on first element.
they should read along following pattern:
foreach(_loop_var ${list_of_values}) # stuff ${_loop_var} endforeach(_loop_var)
i'm sure problem facing symptom of cmake not having searched qt5 modules want search for. might want recheck cmake cache , log output.
side note: bad practice hard code absolute paths system components cmake files. renders cmake (almost) useless. if don't want give lot of command line arguments cmake specify specific locations, read toolchain files.
if cmakelists file example template somewhere, i'd recommend not use source cmake related advice.
Comments
Post a Comment