mingw-cross-env-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Mingw-cross-env-list] find_package() and Shared Builds in CMake


From: Rashad M
Subject: Re: [Mingw-cross-env-list] find_package() and Shared Builds in CMake
Date: Sat, 18 Jul 2015 19:14:36 +0200



On Sat, Jul 18, 2015 at 2:25 AM, Nathan Osman <address@hidden> wrote:
I'm putting together an .mk file for a Qt library that uses CMake. I was able to fill in most of the $(PKG)_* variables without any issues. In particular, the library's only dependencies are gcc and qtbase.

However, I ran into some issues with $(PKG)_BUILD. The library uses "find_package(Qt5Network)" which causes the following error message:

Could not find a package configuration file provided by "Qt5Network"...

I was able to work around this by using the following line to invoke CMake:

cmake .. \
        -DCMAKE_TOOLCHAIN_FILE='$(CMAKE_TOOLCHAIN_FILE)' \
        -DCMAKE_PREFIX_PATH='$(PREFIX)/$(TARGET)/qt5/lib/cmake'

yes using CMAKE_TOOLCHAIN_FILE should be the right thing here. 
Is this the correct way of solving the issue?

The second issue deals with building a shared version of the library. By default, the CMake script builds a shared library but it can be configured to build a static library by using "-DBUILD_STATIC=ON". Should this be enabled in the $(PKG)_BUILD variable? How would I disable this for a shared library?

you can use something like

-DCMAKE_TOOLCHAIN_FILE='$(CMAKE_TOOLCHAIN_FILE)' \ 
-DBUILD_SHARED_LIBS=$(if $(BUILD_STATIC),FALSE,TRUE) \ 

This will build static or shared depending on the your MXE_TARGET in settings.mk




- Nathan



--
Regards,
   Rashad

reply via email to

[Prev in Thread] Current Thread [Next in Thread]