Qt Creator running CMake with different configuration - qt

I'm trying to build a CMakeLists project using Qt Creator 4.8.1. The problem is, I need to run CMake inside a different nativesysroot.
I tried to create a bash script that runs CMake inside the other environment and added it to my kit. As follows:
#!/bin/bash
cd ~/Desktop/Workspace/my_proj/build &&\
~/Desktop/Workspace/my_proj/sdk-x86_64/opt/nativesysroot/usr/bin/sysroot\
~/Desktop/Workspace/my_proj/sdk-vmwx86-x86_64/opt/nativesysroot/usr/bin/cmake "$#"
Such that, sysroot is an executable that changes the current nativesysroot.
The problem is this does not work because Qt Creator is trying to run CMake using the following configuration:
Running "/home/***/Desktop/Workspace/my_proj/script.sh -E server --pipe=/tmp/cmake-.ewYqvn/socket --experimental" in /tmp/QtCreator-kruzfX/qtc-cmake-YOZsCIQx.
This of course causes CMake server connection lost. I tried the look around how to disable the CMake running in server mode but I did not find anything in Qt Creator.
My question is, how to disable CMake in server mode? Or, how to instruct Qt Creator to run my script without adding any flags or options?
Thanks.

Related

Do I really need a './configure' script for my qt-based project?

I have already a Makefile generated from a .pro file (via qmake). The only error message that gcc would report would probably be that Qt is not installed on the target machine.
qmake is the "configure" - and it actually allows implementing configure tests, that's how modern Qt is built. The old "configure" script is no more, even for Qt. qmake does it all.
You cannot redistribute a qmake-generated Makefile, as it's not portable at all. It is specific to whichever Qt installation you want to build the project with. Recall that a user may have multiple of those.
You can include the following "configure" script with a Qt project:
#! /bin/sh
qmake .

Compiling nginx using CLion (via CMake)

I'm trying to compile nginx 1.9.5 via CLion for debugging purposes.
Because CLion doesn't currently support vanilla Makefiles/Autoconf I ran the autoconf auto/configure script to generate a valid Makefile, opened the project in CLion, then made a very simple CMakeLists.txt to delegate the CLion build to the autoconf generated Makefile (as advised by Using local makefile for CLion instead of CMake).
Unfortunately, my simple CMakeLists.txt seems to have a flaw, as when I reload and run CLion's build command, CMake seems to generate yet a new Makefile and run this empty Make task instead of running the one in ${nginx_SOURCE_DIR}.
How can I change the CMakeLists.txt file below to delegate to the nginx Makefile instead of regenerating a new one?
cmake_minimum_required(VERSION 2.8.4)
project(nginx)
add_custom_target(nginx ALL COMMAND make -C ${nginx_SOURCE_DIR} CLION_EXE_DIR=${PROJECT_BINARY_DIR})

Qt Creator No CMake generators on raspberry pi

I have installed qt creator on raspberry pi. sudo apt-get install qtcreator. The program launches and seems to be working except when I load in a cmake project I cannot run cmake through qt creator because qt creator does not detect any cmake generators. When I run cmake -h from the command line there are many cmake generators listed. I want to use the standard Unix Makefiles generator. I have also checked that make is installed and working from the command line on my raspberry pi.
Other details: Running the latest Raspbian, qt creator 2.5, qt 4.8.2,
I had the same problem on Ubuntu after messing with my GCC installation. Maybe the following fix will also work on a Raspberry Pi:
Go to View -> Options -> Build & Run
Go to the "Kits" tab and make sure that a compiler is selected.
Go to the "CMake" tab and hit "Add" to specify the path to your cmake, e.g./usr/bin/cmake. Do this even if the same path is already there as an autodetected cmake.
Select your newly added cmake and hit "Make Default".

Qt creator: qmake is not recognized

I am trying to understand 'qmake' by following this tutorial . but when I come the the following command:
qmake -o Makefile hello.pro
my command line console shows me this message:
'qmake' is not recognized as an internal or external command, operable program or batch file
I understood that qmake is part of Qt creator and thus it should be executed whenever I run it within my project's folder. so, why it is not recognized ?
In the start menu entry that was created by the installer for Qt, you should find an item that opens a command prompt with all the needed environment variables (including the PATH) already set. For my Qt 5.0.2 install using MingW, it is called "Qt 5.0.2 for Desktop (MinGW 4.7)".
On Windows, you can add path to qmake to PATH or run qmake from directory where it placed, or use absolute path.
Sorry my friend, i donĀ“t speak English very well.
In Qt 5.10.1 I resolved this problem running the command prompt in the next path, C:\Qt\5.10.1\mingw53_32>, after you need change the directory where is the file hello.pro and run the commnand qmake -o Makefile hello.pro after you can see the makefile in the respective folder.

Developing Qt applications in Unix systems using Qt Creator

I'm developing a Qt application in Linux using Qt Creator (2.1 RC). I've created 2 projects, and used the wizard to add the library project to the application project. However when I run it, I receive the error:
/home/jakepetroules/silverlock/silverlock-build-desktop/desktop/silverlock: error while loading shared libraries: libsilverlocklib.so.1: cannot open shared object file: No such file or directory
Is there some qmake variable I can set so that Qt Creator will set up the environment properly to run? It's quite annoying to have to copy all the files to another directory with a launcher script just to be able to test the build. On Windows it works perfectly - Qt Creator automatically adds the directories containing the DLLs to the PATH when it runs your application (where running it from Explorer would say DLL not found). Mac OS X is even worse, having to run install_name_tool on everything...
So how can I set up my qmake files so everything works right from the run button in Qt Creator? Kind of hard to debug without this ability, too.
I've had a similar problem running qt apps with QTCreator on my linux machine. I've solved it by adding following lines to the .pro file of the client application:
unix:LIBS += -L/home/projects/my_libs/ -lmy_lib
unix:{
QMAKE_LFLAGS += -Wl,--rpath=/home/projects/my_libs/
QMAKE_LFLAGS_RPATH=
}
info on rpath is here: rpath
hope this helps, regards
Yes, Creator has a section where you can set whatever environment you need for running your app.
On Creator 2.0.0 this is accessed by: Projects -> Targets -> (your target) -> Run -> Run Environment (after you have opened your project)
You can then add or remove any environment variables you'd like, including LD_LIBRARY_PATH One thing I'm not sure of is if it is possible to substitute e.g. the build path into the value of those variables, so that you don't have to hardcode that into your LD_LIBRARY_PATH.
Another option would be to add a small shell script to your source tree which sets whatever variables are necessary, and add a "Custom executable" run configuration to run that script. That's accessed through the same screen.
Just using this:
unix:LIBS += -L/home/projects/my_libs/ -lmy_lib
unix:{
QMAKE_LFLAGS += -Wl,--rpath=/home/projects/my_libs/
}
It's sloved my problem too.

Resources