Results 1 to 6 of 6

Thread: no rule to make target for importing existing CMake project

  1. #1
    Join Date
    Feb 2015
    Posts
    5

    Default no rule to make target for importing existing CMake project

    I am trying to import a project with C++ files that I already built using cmake and makefile. I am trying to import it into QT creator. However, after importing the project and trying to debug it, I get the error “no rule to make target”. However, the file it is referring to exists and I never had this problem with that file when using cmake. What is going on?

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: no rule to make target for importing existing CMake project

    The file it is looking for does not exist and cannot be generated from the output of another rule. Since we have no other information to go on there nothing much more we can say. Start at the beginning... Does Qt Creator run cmake on your Makelists.txt file? Does it generate a suitable Makefile? ...

  3. #3
    Join Date
    Feb 2015
    Posts
    5

    Default Re: no rule to make target for importing existing CMake project

    Quote Originally Posted by ChrisW67 View Post
    The file it is looking for does not exist and cannot be generated from the output of another rule. Since we have no other information to go on there nothing much more we can say. Start at the beginning... Does Qt Creator run cmake on your Makelists.txt file? Does it generate a suitable Makefile? ...
    When I did `Try File -> Open File or Project` and select the existing CMakeLists.txt file in Project/src/Project/ and then had Qt Creator use cmake to build it, I get the error "CMake Error at CMakeLists.txt:165 (SetupBoost): Unknown CMake command "SetupBoost".

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: no rule to make target for importing existing CMake project

    You have a CMakeLists.txt file referencing a function that CMake cannot find. Where does SetupBoost.cmake exist?

    What is the exact sequence of commands executed to run CMake? Working directory? You should see that in the Compile output pane

  5. #5
    Join Date
    Feb 2015
    Posts
    5

    Default Re: no rule to make target for importing existing CMake project

    Quote Originally Posted by ChrisW67 View Post
    You have a CMakeLists.txt file referencing a function that CMake cannot find. Where does SetupBoost.cmake exist?

    What is the exact sequence of commands executed to run CMake? Working directory? You should see that in the Compile output pane
    SetupBoost.cmake is in ws/mke48/cmake/Project/CMake/SetupBoost.cmake

    I generated the makefile (before using Qt) by going to ws/mke48/cmake/Project/Build, running 'ccmake' with the CMakeLists in the root source folder, pressing 'c' for configure, 'g' to generate the makefiles, 'make', 'ccmake' again, setting PRE_BUILD to false/off, 'c' again, 'g' again, and 'make' again

    The contents for SetupBoost.cmake is below:

    Qt Code:
    1. macro(IncludeBoost)
    2. set(Boost_FOUND FOUND)
    3. set(Boost_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/third-party/boost)
    4. endmacro(IncludeBoost)
    5.  
    6. macro(find_boost)
    7. set(Boost_FOUND FOUND)
    8. set(Boost_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/third-party/boost)
    9. set(Boost_components thread date_time regex filesystem system program_options)
    10. endmacro(find_boost)
    11.  
    12. macro(SetupBoost TargetName)
    13. # message("Setting up boost for target ${TargetName}")
    14. set(Boost_FOUND FOUND)
    15. set(Boost_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/third-party/boost)
    16. # if (NOT DEFINED Boost_USE_MULTITHREADED)
    17. set(Boost_LIBRARIES boost_thread-mt boost_date_time-mt boost_regex-mt boost_filesystem-mt boost_system-mt boost_program_options-mt)
    18. target_link_libraries(${TargetName} ${Boost_LIBRARIES})
    19. endmacro(SetupBoost)
    To copy to clipboard, switch view to plain text mode 

  6. #6
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: no rule to make target for importing existing CMake project

    Qt Creator will generate the Makefile for you using CMake. If you are reusing an existing build directory then you must make sure you remove the existing Makefile and any CMakeCache.txt files.

Similar Threads

  1. No rule to make target
    By Emit in forum Newbie
    Replies: 5
    Last Post: 7th November 2014, 09:24
  2. :: error: No rule to make target
    By kurrachow in forum Newbie
    Replies: 2
    Last Post: 15th March 2011, 13:33
  3. Replies: 1
    Last Post: 5th March 2011, 18:23
  4. No rule to make target
    By Coolname007 in forum Qt Programming
    Replies: 6
    Last Post: 4th March 2011, 20:08
  5. No rule to make target?
    By walsha3000 in forum Qt Programming
    Replies: 1
    Last Post: 2nd July 2010, 05:42

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.