KDevelop4: Set environment variable when before CMake

306 Views Asked by At

Related to my other question here (CMake: Force to use optional include and library path), how do I set an environment variable in Kdevelop4 when debugging the project / executing CMake?

I need to set CMAKE_PREFIX_PATH in order to give certain duplicate libraries installed in another path priority over libraries installed in /usr.

1

There are 1 best solutions below

0
On BEST ANSWER

Not specific to Kdevelop, but you could change your CMakeLists.txt to include another CMake file, if it exists. This file would contain your ad-hoc configuration. For example :

# LocalConfig.cmake
set(CMAKE_PREFIX_PATH "/opt/hhd/geos")

# CMakeLists.txt
include(LocalConfig.cmake OPTIONAL)

find_package(geos)