I have a dll library that i am linking to my main executable. When i put that dll file in the same directory as the executable (cmake-build-debug) my program works fine, but when my projects builds, the dll library is inside the directory cmake-build-debug/private and then it won’t link to it, the program has exit code -1073741515. The library is built in a directory called private with the following CMakeLists:
add_library(log_impl SHARED LogImpl.cpp) target_link_libraries(log_impl PUBLIC log_interface)
And the general project CMakeLists is:
cmake_minimum_required(VERSION 3.20) project(PimplLog) set(CMAKE_CXX_STANDARD 17) add_subdirectory(private) add_subdirectory(public) add_executable(PimplLog main.cpp) target_link_libraries(PimplLog PRIVATE log_impl)
Is there any CMake command or is there something i am doing wrong that won’t allow the executable to see a library inside a directory?
Source: Windows Questions C++