In my case on rpms/simde, I want to compile the testing source in
"both" gcc and clang changing the toolchain macro in the %check
section.
I am seeing this file to use toolchain macro.
https://src.fedoraproject.org/rpms/redhat-rpm-config/blob/master/f/macros...
# %global toolchain clang
In this case what is the best practice to use %{optflags},
%{build_cflags}, %{build_cxxflags} macros?
Because after setting `%global toolchain clang` in the %check section,
these macros are empty.
Here is the simde.spec having both gcc and clang built test cases in
the%check section.
https://src.fedoraproject.org/fork/jaruga/rpms/simde/blob/wip/clang-flto-...
```
%check
...
echo "=== 1.2. tests on gcc with flags ==="
mkdir test/build-gcc-with-flags
pushd test/build-gcc-with-flags
CC=gcc CXX=g++ cmake \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
-DCMAKE_C_FLAGS="%{build_cflags}" \
-DCMAKE_CXX_FLAGS="%{build_cxxflags}" \
..
...
%global toolchain clang
...
echo "=== 2.2. tests on clang with flags ==="
mkdir test/build-clang-with-flags
pushd test/build-clang-with-flags
CC=clang CXX=clang++ cmake \
-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON \
-DCMAKE_C_FLAGS="${build_cflags}" \ # <= ${build_cflags} is empty!
-DCMAKE_CXX_FLAGS="${build_cxxflags}" \ # <= ${build_cxxflags} is empty!
..
```
The scratch build:
https://koji.fedoraproject.org/koji/taskinfo?taskID=48755502
Thanks.
--
Jun | He - His - Him