Issue
I am working with CMakeList.txt file and need to set a path to my lib. Currently I do it this way:
set(pathToOpenCv D:\\OpenCV-android-sdk)
, but I would like to change this hardcoded path to relevant path. I order to do it I saved key value env var
OPEN_CV_PATH = D:\\OpenCV-android-sdk
and edited CMakeList.txt
set(pathToOpenCv ${OPEN_CV_PATH})
But I get an error :
Execution failed for task ':co_decoder_engine_android:externalNativeBuildDebug'.
> Build command failed.
Error while executing process C:\Users\myuser\AppData\Local\Android\Sdk\cmake\3.10.2.4988404\bin\ninja.exe with arguments {-C D:\co_repo\co_main\Tier1.0\co_FileCodec_Engine\DecoderEngineBuilder\co_decoder_engine_android\.cxx\cmake\debug\armeabi-v7a decoder_engine_api decoder_engine_lib libcodec}
ninja: Entering directory `D:\co_repo\co_main\Tier1.0\co_FileCodec_Engine\DecoderEngineBuilder\co_decoder_engine_android\.cxx\cmake\debug\armeabi-v7a'
[0/1] Re-running CMake...
-- Configuring done
-- Generating done
-- Build files have been written to: D:/co_repo/co_main/Tier1.0/co_FileCodec_Engine/DecoderEngineBuilder/co_decoder_engine_android/.cxx/cmake/debug/armeabi-v7a
Looks like CMake
don't know how to convert env var value from key to actual value.
What am I doing wrong?
Solution
What am I doing wrong?
You are reading cmake variable and expecting it to expand to the value of the environment variable.
how to convert env var value from key to actual value.
Read the environment variable.
set(pathToOpenCv $ENV{OPEN_CV_PATH})
Answered By - KamilCuk