В настоящее время я пытаюсь создать проект QT / c ++ с помощью cmake. при запуске cmake --build .
выводится следующее:
Scanning dependencies of target qthread_idl_test_autogen
[ 16%] Automatic MOC and UIC for target qthread_idl_test
[ 16%] Built target qthread_idl_test_autogen
Scanning dependencies of target qthread_idl_test
[ 33%] Building CXX object CMakeFiles/qthread_idl_test.dir/qthread_idl_test_autogen/mocs_compilation.cpp.o
In file included from /Users/tjoudrey/geoqt-sandbox/examples/build/qthread_idl/qthread_idl_test_autogen/mocs_compilation.cpp:3:
In file included from /Users/tjoudrey/geoqt-sandbox/examples/build/qthread_idl/qthread_idl_test_autogen/EWIEGA46WW/moc_simulator_window.cpp:9:
In file included from /Users/tjoudrey/geoqt-sandbox/examples/qthread_idl/simulator_window.h:4:
/Users/tjoudrey/geoqt-sandbox/examples/build/qthread_idl/qthread_idl_test_autogen/include/ui_simulator_window.h:29:10: fatal error:
'qwt_plot.h' file not found
#include "qwt_plot.h"
^~~~~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/qthread_idl_test.dir/qthread_idl_test_autogen/mocs_compilation.cpp.o] Error 1
make[1]: *** [CMakeFiles/qthread_idl_test.dir/all] Error 2
make: *** [all] Error 2
Я точно знаю, что qwt_plot.h действительно присутствует в /usr/local/lib/qwt.framework/Headers
Итак, я предполагаю, что я как-то делаю что-то не так при строительстве. для справки вот результат cmake <project_root>
-> % cmake ../../qthread_idl
-- The C compiler identification is AppleClang 10.0.1.10010046
-- The CXX compiler identification is AppleClang 10.0.1.10010046
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc
-- Check for working C compiler: /Library/Developer/CommandLineTools/usr/bin/cc - works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++
-- Check for working CXX compiler: /Library/Developer/CommandLineTools/usr/bin/c++ - works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found IDL: /Applications/exelis/idl/bin/bin.darwin.x86_64/libidl.dylib
-- Found components for IDL
-- IDL_VERSION = 8.5.1
-- IDL_ROOT_DIR = /Applications/exelis/idl
-- IDL_EXECUTABLE = /Applications/exelis/idl/bin/idl
-- IDL_INCLUDES = /Applications/exelis/idl/external/include
-- IDL_LIBRARIES = /Applications/exelis/idl/bin/bin.darwin.x86_64/libidl.dylib
-- Looking for Q_WS_X11
-- Looking for Q_WS_X11 - not found
-- Looking for Q_WS_WIN
-- Looking for Q_WS_WIN - not found
-- Looking for Q_WS_QWS
-- Looking for Q_WS_QWS - not found
-- Looking for Q_WS_MAC
-- Looking for Q_WS_MAC - found
-- Looking for QT_MAC_USE_COCOA
-- Looking for QT_MAC_USE_COCOA - found
-- Found Qt4: /usr/local/bin/qmake (found version "4.8.7")
-- Found Qwt: /usr/local/lib/qwt.framework
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/tjoudrey/geoqt-sandbox/examples/build/qthread_idl
edit: вот и CMakeList.txt
cmake_minimum_required(VERSION 3.10)
project(qthread_idl_test)
# homebrew-specific
list(APPEND CMAKE_MODULE_PATH "/usr/local/opt/cmake/share/cmake/Modules")
# adds Find*.cmake modules for this project
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
if(APPLE)
# both required for FindIDL.cmake
set(IDL_ROOT_DIR "/Applications/exelis/idl")
set(ENV{DYLD_FALLBACK_LIBRARY_PATH} "/Applications/exelis/idl/bin/bin.darwin.x86_64")
# required for FindQwt.cmake
set(QWT_INCLUDE_DIR "/usr/local/lib/qwt.framework/Headers")
endif(APPLE)
# auto-run moc/uic/rcc
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# collect sources
set(SOURCES
main.cpp
simulator_window.cpp
simulator_session.cpp
)
set(MOC_HEADERS
simulator_session.h
simulator_window.h
)
set(UIS
simulator_window.ui
)
set(RESOURCES
simulator_window.qrc
)
include(FindPackageHandleStandardArgs)
find_package(IDL REQUIRED)
find_package(Qt4 REQUIRED)
find_package(Qwt REQUIRED)
include(${QT_USE_FILE})
add_definitions(${QT_DEFINITIONS})
include_directories(${CMAKE_BINARY_DIR})
add_executable( qthread_idl_test ${SOURCES} ${MOC_SRCS} ${RES_SOURCES} ${UI_HEADERS} )
target_include_directories(qthread_idl_test PUBLIC "${IDL_INCLUDES}" "${QWT_INCLUDE_DIRS}")
target_link_libraries(qthread_idl_test PRIVATE ${IDL_LIBRARIES} ${QT_LIBRARIES} ${QWT_LIBRARIES})
target_compile_options(qthread_idl_test PRIVATE -Wall)
install(TARGETS qthread_idl_test DESTINATION bin)
install(SCRIPT Qthread_IDL_Test DESTINATION bin)
################################################################################
# boilerplate follows: generate proper GUI program on specified platform
if(WIN32) # Check if we are on Windows
if(MSVC) # Check if we are using the Visual Studio compiler
set_target_properties(${PROJECT_NAME} PROPERTIES
WIN32_EXECUTABLE YES
LINK_FLAGS "/ENTRY:mainCRTStartup"
)
elseif(CMAKE_COMPILER_IS_GNUCXX)
# SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mwindows") # Not tested
else()
message(SEND_ERROR "You are using an unsupported Windows compiler! (Not MSVC or GCC)")
endif(MSVC)
elseif(APPLE)
set_target_properties(${PROJECT_NAME} PROPERTIES
MACOSX_BUNDLE YES
)
elseif(UNIX)
# Nothing special required
else()
message(SEND_ERROR "You are on an unsupported platform! (Not Win32, Mac OS X or Unix)")
endif(WIN32)