I am currently working on a project where on the start program reads the config file and perform some operations on it . But when i run the programme it works fine when i compile it via CLion or any other IDE but do not work when i run it via terminal by creating a separate build folder. when i debug i get to to know that when i run it via terminal the CMAKE_CURRENT_BINARY_DIR is build and when i run it via some IDE it is build/src. My exe file is generated inside src folder. So to make thing work i copied the Config file to both directories and it is working fine . But that is not a good approach i wanted to have a single config file for both environment . I am new to CMake any help would be really appreciated.
Here is my cmake file
CMakeLists.txt
cmake_minimum_required(VERSION 3.10)
project(test)
set(CMAKE_CXX_STANDARD 17)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.ini ${CMAKE_CURRENT_BINARY_DIR})
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/src/config.ini ${CMAKE_CURRENT_BINARY_DIR}/src/config.ini)
add_subdirectory(src)