I have a project that I am building using CMake
for Visual Studio
.
The .exe
file requires 2 dll files (That I am copying to the Debug forlder for now).
Is there a way to add the dlls/ dlls directory through CMakeLists.txt
/ FindLibrary.cmake
(the same way it's done with find_library to find *.lib
or in some other way that I ignore) so that I don't copy them MANUALLY inside the Debug folder each time I generate the project in another folder/pc (since the dll's folder is known)?
UPDATE :
CMakeLists.txt
..
..
set (ENVLIB $ENV{MYLIB})
FUNCTION (CONFIGURE_DEBUGGER TARGET_NAME)
CONFIGURE_FILE(common/build/template/Main.vcxproj.user
${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.vcxproj.user
@ONLY
)
ENDFUNCTION (CONFIGURE_DEBUGGER)
..
..
ADD_EXECUTABLE(Main Main.cxx)
CONFIGURE_DEBUGGER(Main)
Main.vcxproj.user
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerCommandArguments>-D20</LocalDebuggerCommandArguments>
<LocalDebuggerEnvironment>PATH=@ENVLIB@bin;$(Path)
$(LocalDebuggerEnvironment)</LocalDebuggerEnvironment>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<!-- Additional PropertyGroups for the rest of Configuration/Platform combos -->
</Project>
Output of vcxproj.user after generation
<LocalDebuggerEnvironment>PATH=C:\Program Files\MyLib\bin;$(Path)
The variable ENVLIB
has been changed to the correct PATH when the file has been copied but
Visual studio is still asking for those DLLs. It's like it is ignoring the file .vcxproj.user
SOLVED :
Solved changed the property : <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
to <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">