Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. CMake not include .dll
Forum Update on Monday, May 27th 2025

CMake not include .dll

Scheduled Pinned Locked Moved Unsolved General and Desktop
dllcmake
5 Posts 3 Posters 736 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    timob256
    wrote on 18 Jul 2023, 13:14 last edited by
    #1

    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 ?

    J 2 Replies Last reply 18 Jul 2023, 13:17
    0
    • T timob256
      18 Jul 2023, 13:14

      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 ?

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 18 Jul 2023, 13:17 last edited by
      #2
      This post is deleted!
      1 Reply Last reply
      0
      • J jsulm locked this topic on 18 Jul 2023, 13:17
      • J jsulm unlocked this topic on 18 Jul 2023, 13:18
      • T timob256
        18 Jul 2023, 13:14

        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 ?

        J Offline
        J Offline
        jsulm
        Lifetime Qt Champion
        wrote on 18 Jul 2023, 13:24 last edited by
        #3

        @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?

        T 1 Reply Last reply 18 Jul 2023, 22:59
        0
        • J jsulm
          18 Jul 2023, 13:24

          @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?

          T Offline
          T Offline
          timob256
          wrote on 18 Jul 2023, 22:59 last edited by
          #4

          @jsulm

          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)
          
          semlanikS 1 Reply Last reply 1 Aug 2023, 13:38
          0
          • T timob256
            18 Jul 2023, 22:59

            @jsulm

            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)
            
            semlanikS Offline
            semlanikS Offline
            semlanik
            wrote on 1 Aug 2023, 13:38 last edited by semlanik 8 Jan 2023, 13:39
            #5

            @timob256

            target_link_libraries(${PROJECT_NAME} PRIVATE ${Qt5AxContainer_LIBRARIES})
            target_link_libraries(compas_com_example PRIVATE Qt${QT_VERSION_MAJOR}::Core)
            
            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved