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
QtWS25 Last Chance

CMake not include .dll

Scheduled Pinned Locked Moved Unsolved General and Desktop
dllcmake
5 Posts 3 Posters 726 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.
  • timob256T Offline
    timob256T Offline
    timob256
    wrote on 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 ?

    jsulmJ 2 Replies Last reply
    0
    • timob256T timob256

      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 ?

      jsulmJ Online
      jsulmJ Online
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2
      This post is deleted!
      1 Reply Last reply
      0
      • jsulmJ jsulm locked this topic on
      • jsulmJ jsulm unlocked this topic on
      • timob256T timob256

        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 ?

        jsulmJ Online
        jsulmJ Online
        jsulm
        Lifetime Qt Champion
        wrote on 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?

        timob256T 1 Reply Last reply
        0
        • jsulmJ jsulm

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

          timob256T Offline
          timob256T Offline
          timob256
          wrote on 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
          0
          • timob256T timob256

            @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 last edited by semlanik
            #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