Thread: Converting cmake project to qmake

  1. #1
    Registered User Zeeshan's Avatar
    Join Date
    Oct 2001
    Location
    London, United Kingdom
    Posts
    226

    Unhappy Converting cmake project to qmake

    Hi all,

    I am trying to convert a rather simple CMakeLists.txt to a qmake project. The project compiles fine but I can't get the output I want (the program files are the same!).

    It shouldn't be a big deal, but I have spent the whole day and can't seem to figure out the problem. Any help would be greatly appreciated.

    Here's the CMakeLists.txt that I am trying to convert:

    Code:
    cmake_minimum_required (VERSION 2.6) 
    PROJECT (sdpwrapper) 
    
    #set the default path for built executables to the "bin" directory
    SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)
    #set the default path for built libraries to the "lib" directory
    SET(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib)
    
    FIND_PACKAGE(OpenCV REQUIRED)
    
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
    
    ADD_LIBRARY(objdettrack 
        ./src/MyPipe.cpp 
        ./src/SDPWrapper.cpp 
        ./src/online_tracker.cpp
        ./src/BaseObjectTracker2D.cpp)
    
    INCLUDE_DIRECTORIES(include 
        /usr/include/python2.7 
        ../dep/NOMT/include/ 
        ../dep/NOMT/dep/eigen/ 
        ../dep/NOMT/dep/libDAI-0.3.2/include/)
    
    TARGET_LINK_LIBRARIES(objdettrack
        ${PROJECT_SOURCE_DIR}/../dep/NOMT/lib/libcppmodule.so
        python2.7
        ${OpenCV_LIBS})
    
    ADD_EXECUTABLE(example ./src/main.cpp)
    TARGET_LINK_LIBRARIES(example objdettrack)
    
    FIND_PACKAGE(OpenMP)
    IF(OPENMP_FOUND)
      SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
      SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
      SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_C_FLAGS}")
    ENDIF()
    and here's the qmake project file I created:

    Code:
    QT       += widgets
    
    TARGET = ./build/DummyProject
    #CONFIG   += console
    #CONFIG   -= app_bundle
    
    SOURCES += ./src/main.cpp \
        ./src/MyPipe.cpp \
        ./src/online_tracker.cpp \
        ./src/SDPWrapper.cpp \
        ./src/BaseObjectTracker2D.cpp
    
    TEMPLATE = app
    #TEMPLATE += lib
    
    
    
    # ZEESHAN:INTEGRATION CODE
    INCLUDEPATH += ./include
    INCLUDEPATH += /usr/include/python2.7 
    INCLUDEPATH += /home/ma/zeeshan/code/Joint/KITTI_Jun2016/slam/app/faster-rcnn/dep/NOMT/include/ 
    INCLUDEPATH += /home/ma/zeeshan/code/Joint/KITTI_Jun2016/slam/app/faster-rcnn/dep/NOMT/dep/eigen/ 
    INCLUDEPATH += /home/ma/zeeshan/code/Joint/KITTI_Jun2016/slam/app/faster-rcnn/dep/NOMT/dep/libDAI-0.3.2/include/
    
    QMAKE_LIBDIR += /home/ma/zeeshan/code/Joint/KITTI_Jun2016/slam/app/faster-rcnn/dep/NOMT/lib
    LIBS += -lcppmodule
    LIBS += -lpython2.7
    LIBS += -lpynomt
    
    QMAKE_LIBDIR += ../../faster-rcnn/cpp/lib
    LIBS += -Lobjdettrack
    
    CONFIG += link_pkgconfig
    PKGCONFIG += opencv
    
    QMAKE_CXXFLAGS+= -fopenmp
    QMAKE_LFLAGS +=  -fopenmp
    Thanks a lot in advance,
    Zeeshan
    Last edited by Zeeshan; 07-25-2016 at 08:49 PM.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    cmake - Using Qt Creator to Open CMakeLists.txt, and how to save as a .pro file? - Stack Overflow

    > LIBS += -Lobjdettrack
    You're not creating a library.

    The cmake project had four source files compiled to a library, and main.cpp compiled directly to executable, and linked with all the other code via libraries.

    Your qmake project compiles five files, and links with 3rd party libs.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. i need help with cmake, BISON and FLEX, i am willing to pay
    By Yakir Manor in forum Projects and Job Recruitment
    Replies: 1
    Last Post: 01-17-2012, 04:54 PM
  2. cmake - using header files in higher directories
    By coletek in forum C Programming
    Replies: 2
    Last Post: 11-02-2010, 07:18 PM
  3. Compiling errors and using Cmake Set Policy
    By eligor in forum Linux Programming
    Replies: 2
    Last Post: 01-25-2010, 01:43 PM
  4. Replies: 1
    Last Post: 12-05-2008, 02:51 PM
  5. I'm converting a C++ project to C
    By gotclout in forum C Programming
    Replies: 14
    Last Post: 05-28-2008, 02:08 PM

Tags for this Thread