Reputation: 1421
I want to prefix the compiler with a utility script, so instead of for example g++-4.7 main.cpp
,kinst-ompp g++-4.7 main.cpp
is invoked.
I tried doing this in the CMakeLists.txt, but I'm getting a "not found" error:
set(CMAKE_CXX_COMPILER "${OMPP_CXX} ${CMAKE_CXX_COMPILER}")
set(CMAKE_C_COMPILER "${OMPP_CC} ${CMAKE_C_COMPILER}")
How do I properly configure this using CMake?
Upvotes: 2
Views: 3901
Reputation: 672
I got this to work by setting my compiler to the prefix and then passing the real compiler name as first argument. Ugly, I know.
set(CMAKE_CXX_COMPILER "${OMPP_CXX}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_COMPILER} ${commonCXXFlags} ${commonReleaseFlags}")
Upvotes: 0
Reputation: 78358
You should avoid setting the compiler in this way - see cmake: problems specifying the compiler (2) and this CMake FAQ entry for more info.
I think the following should work (after deleting your CMakeCache.txt):
export CC="kinst-ompp gcc-4.7" CXX="kinst-ompp g++-4.7" cmake <Path to CMakeLists.txt>
Upvotes: 2