0

Is job in qmake:

LIBS+= -L"C:\Program Files\program\any_dll.dll"

How to in cmake?

cmake_minimum_required(VERSION 2.8)

project(my_project)

add_executable(${PROJECT_NAME} "main.cpp")
shaman888
  • 283
  • 1
  • 10
  • `add_library(bar SHARED/STATIC IMPORTED)` ? Check https://stackoverflow.com/questions/28597351/how-do-i-add-a-library-path-in-cmake – ustulation Sep 04 '19 at 11:30
  • @Tsyvarev mylib.so is not anydll.dll. Functionally, it is indeed a duplicate, but from the point of view of the text, these are different issues. I believe that this issue should remain so that it can be found in the search. – shaman888 Sep 05 '19 at 10:21
  • 1
    "but from the point of view of the text, these are different issues." - Whatever *static* or *shared*, Linux (`.so`) or Windows (`.dll`), `any_dll.dll` is an **external library** for your CMake project, so the duplicate question has been chosen correctly. "I believe that this issue should remain so that it can be found in the search." - *Duplicate* status by no means marks the question as "bad" or "should be deleted". If someone will find your question useful, he/she still able to upvote it. The only thing which is disabled by *duplicate* status is adding (new) answers for the question. – Tsyvarev Sep 05 '19 at 11:42
  • BTW, the banner "This question already has an answer here" and its reference are tied to the question post while it is in a *duplicate* status. So there is no needs to repeat reference to the duplicate question in the question post itself. (You may include the reference to other question post if it helps to **understand** your **question**, but I see no reason for it in your case. Note, that "understand a question" doesn't mean "understand how to *resolve* it". On Stack Overflow we don't mix a problems and their possible resolutions in the question post.) – Tsyvarev Sep 05 '19 at 11:51

1 Answers1

1

If CMake does not now a target (i.e. it is not build by CMake) it assumes it to be a prebuild library.

link_directories(
  "C:/Program Files/program"
)

add_executable(${PROJECT_NAME} "main.cpp")

target_link_libraries(${PROJECT_NAME}
  any_dll
)
shaman888
  • 283
  • 1
  • 10
IIRistoII
  • 320
  • 1
  • 7