CMake not include .dll
Unsolved
General and Desktop
-
CMakeLists.txt
cmake_minimum_required(VERSION 3.14) project(compas_com_example LANGUAGES CXX) set(CMAKE_AUTOUIC ON) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC ON) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core) find_package(Qt5AxContainer REQUIRED) include_directories( ${Qt5AxContainer_INCLUDE_DIRS} ) add_definitions(${Qt5AxContainer_DEFINITIONS}) add_executable(compas_com_example main.cpp ) include_directories(${Qt5Widgets_INCLUDES} ${Qt5AxContainer_INCLUDE_DIRS}) target_link_libraries(${PROJECT_NAME} ${Qt5AxContainer_LIBRARIES}) target_link_libraries(compas_com_example Qt${QT_VERSION_MAJOR}::Core) install(TARGETS compas_com_example LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/"C:\Program Files\ASCON\KOMPAS-3D v20\Bin"") target_link_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/ "C:\Program Files\ASCON\KOMPAS-3D v20\SDK\Include") target_link_libraries(${PROJECT_NAME} PUBLIC kAPI5.DLL)
compas_com_example\CMakeLists.txt:38: error: Parse error. Function missing ending ")". Instead found unterminated string with text ") target_link_libraries(${PROJECT_NAME} PUBLIC kAPI5.DLL) ".
why error ;_; why ?
-
-
-
@timob256 said in CMake not include .dll:
why error ;_; why ?
Because what you're doing is simply wrong.
Please read what you wrote in CMakeLists.txt carefully!Why do you add Bin folder to the include folders?!
Why do you add Include folder to link folders?!
Don't you think it should be other way around?
The way you're using target_link_libraries is also wrong.Does this library provide CMake integration?
-
thank you reply.
I fixed the errors , but I can 't get away with the last one
target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/ "C:\\Program Files\\ASCON\\KOMPAS-3D v20\\SDK\\Include") target_link_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/ "C:\\Program Files\\ASCON\\KOMPAS-3D v20\\Bin" ) target_link_libraries(${PROJECT_NAME} PUBLIC "C:\\Program Files\\ASCON\\KOMPAS-3D v20\\Bin\\kAPI5.DLL")
errors
E:\velog\compas_com_example\CMakeLists.txt:36: error: The plain signature for target_link_libraries has already been used with the target "compas_com_example". All uses of target_link_libraries with a target must be either all-keyword or all-plain. The uses of the plain signature are here: * CMakeLists.txt:26 (target_link_libraries) * CMakeLists.txt:27 (target_link_libraries)