Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Help with cmake

Help with cmake

Scheduled Pinned Locked Moved Qt Creator and other tools
2 Posts 2 Posters 861 Views 1 Watching
  • 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.
  • E Offline
    E Offline
    Exotic_Devel
    wrote on last edited by
    #1

    I'm trying to migrate a small "project":https://github.com/matheusssilva/DynamicQtWidgets to cmake, but I am not succeeding in creating the cmake file.

    The project consists of a dynamic library and a unit test. First the library must be compiled and then the test should be compiled because the test includes the dynamic library.

    my cmake file

    @#minimum version required
    cmake_minimum_required(VERSION 2.8)

    #set variable for project name
    set (LIB_NAME "$dynamicqtwidgets")

    #set variable current dir
    set (ROOT "$CMAKE_CURRENT_SOURCE_DIR")

    #project name
    project(PRO_NAME)

    #dirs
    list (APPEND DIRS
    "${ROOT}/dynamicqtwidgets"
    )

    #include dir
    include_directories(${DIRS})

    #look in binary dir for include moc files
    set (CMAKE_INCLUDE_CURRENT_DIR ON)

    #run moc if needed
    set (CMAKE_AUTOMOC ON)

    #find Qt5 widgets libs
    find_package(Qt5Widgets REQUIRED)

    add_library(dynamicqtwidgets SHARED dynamicqtwidgets_global.hpp dynamicqtwidgets.hpp dynamicqtwidgets.cpp)

    add_executable(tests dynamicqtwidgetstests.hpp dynamicqtwidgetstests.cpp main.cpp)

    target_link_libraries(tests dynamicqtwidgets)@

    erro

    -CMake Error at CMakeLists.txt:30 (add_library):
    Cannot find source file:

    dynamicqtwidgets_global.hpp
    

    Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
    .hxx .in .txx-

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on last edited by
      #2

      Hi,

      in add_library, add_executable the sources must specified in absolute PATH or in PATH relative to the CMakeLists.txt file.

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      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