CMAKE_PREFIX_PATH does not work as expected
-
@Ahmed-Yarub-Hani-Al-Nuaimi Try to use full path of ~/Qt/5.15.0/wasm_32 to set PATH and LD_LIBRARY_PATH
-
@JoeCFD
echo $PATH
/home/fifothekid/Downloads/cmake-3.18.0-Linux-x86_64/bin:/home/fifothekid/Qt/5.15.0/wasm_32/bin/:/home/fifothekid/.wasmer/bin:/home/fifothekid/.wasienv/bin:/home/fifothekid/Documents/emsdk:/home/fifothekid/Documents/emsdk/upstream/emscripten:/home/fifothekid/Documents/emsdk/node/12.18.1_64bit/bin:/home/fifothekid/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/fifothekid/.wasmer/globals/wapm_packages/.binecho $LD_LIBRARY_PATH
/home/fifothekid/Qt/5.15.0/wasm_32/lib/and then tried /home/fifothekid/Qt/5.15.0/wasm_32
-
@Ahmed-Yarub-Hani-Al-Nuaimi type
which qmakethis is the only line in my cmake file to find Qt 5
find_package(Qt5 REQUIRED Core Gui Widgets Svg Xml Network DBus OpenGL Multimedia WebEngineWidgets) -
which qmake
/home/fifothekid/Qt/5.15.0/wasm_32/bin//qmake -
@Ahmed-Yarub-Hani-Al-Nuaimi
I tried this
cmake_minimum_required(VERSION 3.10)
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
project(basic_qml)set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)set(CMAKE_CXX_STANDARD 17)
set (Qt5_FOUND false)
find_package(Qt5 COMPONENTS Core
Gui
Svg
Xml
Qml
Quick
QuickControls2 REQUIRED)if(Qt5_FOUND)
message("QT5 framework found")
else(Qt5_FOUND)
message(FATAL_ERROR "No QT5 framework found")
endif(Qt5_FOUND)==========================================================
the output:
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /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: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
QT5 framework found
-- Configuring done
-- Generating done
-- Build files have been written to: -
Are you cross-compiling for wasm32?
-
@Ahmed-Yarub-Hani-Al-Nuaimi this is only on linux ubuntu
-
I know. It does work if you are building for Ubuntu on Ubuntu. It's cross-compilation that doesn't work. According to official documentations, setting CMAKE_PREFIX_PATH should be enough, but it's not.
I had the same problem compiling for Android on Ubuntu and Windows, for iOS on MacOS, and for WebAssembly on Ubuntu. -
@Ahmed-Yarub-Hani-Al-Nuaimi
cmake -DCMAKE_PREFIX_PATH=$QT_DIR/lib/cmake ..
-- The C compiler identification is GNU 7.5.0
-- The CXX compiler identification is GNU 7.5.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /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: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
QT5 framework found
-- Configuring done
-- Generating done
-- Build files have been written to:works as well without PATH and LIB settings. But this does not set qmake path. It is safe to set path and lib manually. Sure it is not needed if you install qt under root.
-
Can you try compiling for wasm32?
-
@Ahmed-Yarub-Hani-Al-Nuaimi I only confirmed that Qt 5 can be found. If it can be found, you will be able to compile it.