Hi,
From what I notice when trying create rpm on RHEL7, is that CMake utilize pkg-config, which is nice. But when ninja/make rpm-package is executed, that part seems to stop. Instead we rely on rpm instead.
which cmake
/app/vbuild/RHEL7-x86_64/cmake/3.7.2-1/bin/cmake
cmake -G Ninja -DENABLE_GNUTLS=OFF -DENABLE_LZ4=OFF -DENABLE_CARES=OFF ../
..
ninja rpm-package
..
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.wOs6eR
..
+ /usr/bin/cmake -DCMAKE_C_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_CXX_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_Fortran_FLAGS_RELEASE:STRING=-DNDEBUG -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr/local -DINCLUDE_INSTALL_DIR:PATH=/usr/local/include -DLIB_INSTALL_DIR:PATH=/usr/local/lib64 -DSYSCONF_INSTALL_DIR:PATH=/etc -DSHARE_INSTALL_PREFIX:PATH=/usr/local/share -DLIB_SUFFIX=64 -DBUILD_SHARED_LIBS:BOOL=ON -DBUILD_wireshark=ON -DENABLE_LUA=OFF -DBUILD_mmdbresolve=ON -DENABLE_LZ4=OFF -DENABLE_SNAPPY=OFF -DENABLE_CARES=OFF -DENABLE_SPANDSP=ON -DENABLE_BCG729=ON -DENABLE_LIBXML2=ON -DENABLE_NGHTTP2=OFF -DDISABLE_WERROR=ON -G Ninja
CMake Error: CMake was unable to find a build program corresponding to "Ninja". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: Error required internal CMake variable not set, cmake may be not be built correctly.
Missing variable is:
CMAKE_C_COMPILER_ENV_VAR
..
and more error...
Problem is the version of CMake, not the one I wanted.
/usr/bin/cmake
--version
cmake version 2.8.12.2
BuildRequires: cmake
..
%cmake
This part will utilize rpm instead of what CMake setup for us, same for all packages.
rpm --eval %cmake
..
/usr/bin/cmake \
-DCMAKE_C_FLAGS_RELEASE:STRING="-DNDEBUG" \
-DCMAKE_CXX_FLAGS_RELEASE:STRING="-DNDEBUG" \
-DCMAKE_Fortran_FLAGS_RELEASE:STRING="-DNDEBUG" \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
-DCMAKE_INSTALL_PREFIX:PATH=/usr \
-DINCLUDE_INSTALL_DIR:PATH=/usr/include \
-DLIB_INSTALL_DIR:PATH=/usr/lib64 \
-DSYSCONF_INSTALL_DIR:PATH=/etc \
-DSHARE_INSTALL_PREFIX:PATH=/usr/share \
%if "lib64" == "lib64"
-DLIB_SUFFIX=64 \
%endif
-DBUILD_SHARED_LIBS:BOOL=ON
A workaround I found was to create ~/.rpmmacros with content:
%__cmake %(which cmake)
Should we maybe have rpmmacros directly in package/rpm ?
And it doesn't seems that it respect the compile parameter check either, same problem Anders had regarding
cc: error: unrecognized command line option '-Wheader-guard'
..
I see this faults too, but haven't found a solution for it
//Joakim