CMake - change current directory ( for example: project/build ) from CMakeLists.txt?
bash, cmake, linux
Solution
The `WORKING_DIRECTORY` directive of the `execute_process` command lets you directly specify the directory the script is to be run from.
execute_process(COMMAND ${CMAKE_SOURCE_DIR}/script.sh args
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
Problem
I'm building project with CMake. While configuration and building I'm in directory project/build . How can I change the directory in CMake and execute a bash script from another directory. execute_process( COMMAND cd ../ ) - doesn't work. When I execute this CMake doesn't change its directory and I'm again in project/build.