0

I have cmake app which build an window exe. On windows os.

add_executable(app ${app_SRC})
SET_TARGET_PROPERTIES(app PROPERTIES LINK_FLAGS  "/MANIFESTUAC:\"level='requireAdministrator' uiAccess='false'\" /SUBSYSTEM:WINDOWS")
target_include_directories(app PRIVATE ${wxWidgets_INCLUDE_DIRS})
target_link_libraries(app ${wxWidgets_LIBRARIES})

It build app.exe success. But when I run app.exe. The error dialog show: Can't find wxbase314ud_vc_custom.dll.

How can I config the dll path?

I know I can copy the dlls to the exe folder, but is there any other way to do this in CMakeLists.txt?

user3875388
  • 541
  • 1
  • 6
  • 19
  • Try taking a look at this, seems to be your same use case: https://stackoverflow.com/questions/10671916/how-to-copy-dll-files-into-the-same-folder-as-the-executable-using-cmake – dwosk Oct 03 '20 at 18:19
  • 1
    "I know I can copy the dlls to the exe folder, but there any other way to do this in `CMakeLists.txt`." - If you expect CMake to do things which cannot be done by the compiler or OS, then you are wrong. In case of searching for `.dll`, Windows provides no other way that putting it to the `PATH` or place `.dll` near the executable. CMake offers no ways above that. – Tsyvarev Oct 03 '20 at 18:20

0 Answers0