Our project is often cross compiled, so we want to allow a different target C++ compiler which is different from the one that runs on the frontend node. The CMakeLists.txt
contain the following:
OPTION(target_cxx "select target CXX Compiler for building libqphix-codegen.a" ${CMAKE_CXX_COMPILER})
OPTION(target_cxxflags "select target CXXFLAGS for building libqphix-codege.a" ${CMAKE_CXX_FLAGS})
When I call that with cmake ~/Projekte/qphix-codegen/ -Disa=avx -DCMAKE_CXX_COMPILER=g++ -DCMAKE_CXX_FLAGS='-O3 -march=sandybridge'
, I would expect that target_cxx
gets set to that g++
and the flags accordingly. However, the value of target_cxx
is OFF
.
I need to specify -Dtarget_cxx
in order to get some other value than OFF
.
Is there something one can do differently such that those variables get a sensible default value? I have the impression that the default value is evaluated too early.