Generating custom Makefiles in Qt



  • I'm struggling with getting Qt (on win 10, x64, mingw 32-bit) to create a custom Makefile given the following CMakeLists.txt file:

    cmake_minimum_required(VERSION 3.10)
    project (Stockfish)
    
    
    # Boost enviroment variable checking shamelessly taken from:
    # https://stackoverflow.com/a/8081804/1079483
    # Checks if environment variable BOOST_ROOT is set properly.
    if(NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "")
        file(TO_CMAKE_PATH $ENV{BOOST_ROOT} BOOST_ROOT)
        if(NOT EXISTS ${BOOST_ROOT})
            message(STATUS  ${BOOST_ROOT} " does not exist. Checking if BOOST_ROOT was a quoted string..")
            string(REPLACE "\"" "" BOOST_ROOT ${BOOST_ROOT})
            if(EXISTS ${BOOST_ROOT})
                message(STATUS "After removing the quotes " ${BOOST_ROOT} " was now found by CMake")
            endif(EXISTS ${BOOST_ROOT})
        endif(NOT EXISTS ${BOOST_ROOT})
    
        # Save the BOOST_ROOT in the cache
        if(NOT EXISTS ${BOOST_ROOT})
            message(WARNING ${BOOST_ROOT} " does not exist.")
        else(NOT EXISTS ${BOOST_ROOT})
            set(BOOST_ROOT ${BOOST_ROOT} CACHE STRING "Set the value of BOOST_ROOT to point to the root folder of your boost install." FORCE)
            #SET (BOOST_INCLUDEDIR ${BOOST_ROOT}/Include)
            #SET (BOOST_LIBRARYDIR ${BOOST_ROOT}/lib)
        endif(NOT EXISTS ${BOOST_ROOT})
    endif(NOT BOOST_ROOT AND NOT $ENV{BOOST_ROOT} STREQUAL "")
    
    if((WIN32 OR WIN64) AND NOT BOOST_ROOT)
        MESSAGE( WARNING "Please set the BOOST_ROOT environment variable." )
    endif((WIN32 OR WIN64) AND NOT BOOST_ROOT)
    
    #set(Boost_ADDITIONAL_VERSIONS "1.47" "1.47.0")
    set(Boost_DEBUG ON)
    set(Boost_USE_STATIC_LIBS       OFF)
    set(Boost_USE_MULTITHREADED      ON)
    set(Boost_USE_STATIC_RUNTIME    OFF)
    find_package(Boost 1.65.1 COMPONENTS ${BOOST_COMPONENTS_NEEDED})
    if(Boost_FOUND)
        message( STATUS "Setting up boost." )
        include_directories(${Boost_INCLUDE_DIRS})
        if(Boost_DEBUG)
            message( STATUS "BOOST Libraries " ${Boost_LIBRARIES} )
            foreach(BOOST_COMPONENT ${BOOST_COMPONENTS_NEEDED})
                string( TOUPPER ${BOOST_COMPONENT} BOOST_COMPONENT_UPCASE )
                message( STATUS "Boost " ${BOOST_COMPONENT} ": " ${Boost_${BOOST_COMPONENT_UPCASE}_LIBRARY} )
                message( STATUS "Boost " ${BOOST_COMPONENT} " Debug: " ${Boost_${BOOST_COMPONENT_UPCASE}_LIBRARY_DEBUG} )
                message( STATUS "Boost " ${BOOST_COMPONENT} " Release: " ${Boost_${BOOST_COMPONENT_UPCASE}_LIBRARY_RELEASE} )
            ENDFOREACH(BOOST_COMPONENT)
        endif(Boost_DEBUG)
    endif(Boost_FOUND)
    
    find_package(Boost 1.65.1 COMPONENTS filesystem regex thread date_time)
    if(Boost_FOUND)
      include_directories(${Boost_INCLUDE_DIRS})
    endif()
    
    # Building Boost requires that mingw's bin/ is in Path
    # Custom build sample:
    # >> bootstrap.bat gcc
    # >> .\b2 --preffix="D:\Path\To\Install\Dir"
    # >> .\b2 --build-dir="D:\Path\To\Build\Dir" --preffix="D:\Path\To\Install\Dir" toolset=gcc install
    set(Boost_USE_STATIC_LIBS OFF)
    set(Boost_USE_MULTITHREADED ON)
    set(Boost_USE_STATIC_RUNTIME OFF)
    set(BOOST_ROOT D:/Libraries/boost_1_65_1/boost_1_65_1)
    set(BOOST_INCLUDEDIR D:/Libraries/boost_1_65_1/boost_1_65_1)
    
    include_directories(D:/Libraries/boost_1_65_1/boost_1_65_1)
    
    message(STATUS "[INFO] CMAKE_SOURCE_DIR      : ${CMAKE_SOURCE_DIR}")
    message(STATUS "[INFO] BOOST_ROOT                : ${BOOST_ROOT}")
    message(STATUS "[INFO] BOOST_INCLUDEDIR       : ${BOOST_INCLUDEDIR}")
    message(STATUS "[INFO] CMAKE_INCLUDE_PATH   : ${CMAKE_INCLUDE_PATH}")
    message(STATUS "[INFO] CMAKE_LIBRARY_PATH   : ${CMAKE_LIBRARY_PATH}")
    message(STATUS "[INFO] CMAKE_VERSION            : ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}")
    message(STATUS "[INFO] Current working directory: ${CMAKE_CURRENT_LIST_DIR}")
    
    add_executable(stockfish benchmark.cpp bitbase.cpp bitboard.cpp endgame.cpp evaluate.cpp
    main.cpp material.cpp misc.cpp movegen.cpp movepick.cpp pawns.cpp position.cpp psqt.cpp
    search.cpp thread.cpp timeman.cpp tt.cpp uci.cpp ucioption.cpp syzygy/tbprobe.cpp)
    # Glob header files as a separate resource
    file(GLOB_RECURSE LibFiles "*.hpp" "*.h")
    add_custom_target(headers SOURCES ${LibFiles})
    set(CMAKE_CXX_FLAGS "-std=c++0x")
    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY /src)
    mark_as_advanced(MULTITHREADED_BUILD)
    set(MULTITHREADED_BUILD 4 CACHE STRING "Number of threads used during build")
    message(STATUS ${CMAKE_BUILD_TOOL})
    
    if(MULTITHREADED_BUILD)
        message(STATUS "[INFO] Added arguments to CMAKE_BUILD_TOOL: ${CMAKE_MAKE_PROGRAM}")
        set(CMAKE_MAKE_PROGRAM "${CMAKE_MAKE_PROGRAM} -j${MULTITHREADED_BUILD}")
    endif()
    
    target_link_libraries(stockfish Boost::filesystem Boost::regex)
    

    After Right clicking on the project --> Run cmake Qt gives:

    Running "D:\InstallDir\CMake\bin\cmake.exe -E server "--pipe=\\.\pipe\{15f7a6b4-49a7-48a6-8c29-7da36b30ee52}" --experimental" in D:\Projects\Chess\stockfish-8-src\stockfish-8-src\build-src-Desktop_Qt_5_9_2_MinGW_32bit-Debug.
    Starting to parse CMake project for Qt Creator.
    CMake Warning at CMakeLists.txt:29 (MESSAGE):
      Please set the BOOST_ROOT environment variable.
    
    
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1078 ] _boost_TEST_VERSIONS = 1.65.1;1.65
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1080 ] Boost_USE_MULTITHREADED = ON
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1082 ] Boost_USE_STATIC_LIBS = OFF
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1084 ] Boost_USE_STATIC_RUNTIME = OFF
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1086 ] Boost_ADDITIONAL_VERSIONS = 
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1088 ] Boost_NO_SYSTEM_PATHS = 
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1156 ] Declared as CMake or Environmental Variables:
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1158 ]   BOOST_ROOT = 
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1160 ]   BOOST_INCLUDEDIR = 
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1162 ]   BOOST_LIBRARYDIR = 
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1164 ] _boost_TEST_VERSIONS = 1.65.1;1.65
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1263 ] location of version.hpp: C:/Boost/include/boost-1_65_1/boost/version.hpp
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1287 ] version.hpp reveals boost 1.65.1
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1373 ] guessed _boost_COMPILER = -mgw53
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1383 ] _boost_MULTITHREADED = -mt
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1427 ] _boost_RELEASE_ABI_TAG = -
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1429 ] _boost_DEBUG_ABI_TAG = -d
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1491 ] _boost_LIBRARY_SEARCH_DIRS_RELEASE = C:/Boost/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH_boost_LIBRARY_SEARCH_DIRS_DEBUG   = C:/Boost/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1767 ] Boost_FOUND = 1
    Boost version: 1.65.1
    Setting up boost.
    BOOST Libraries 
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1078 ] _boost_TEST_VERSIONS = 1.65.1;1.65
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1080 ] Boost_USE_MULTITHREADED = ON
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1082 ] Boost_USE_STATIC_LIBS = OFF
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1084 ] Boost_USE_STATIC_RUNTIME = OFF
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1086 ] Boost_ADDITIONAL_VERSIONS = 
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1088 ] Boost_NO_SYSTEM_PATHS = 
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1156 ] Declared as CMake or Environmental Variables:
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1158 ]   BOOST_ROOT = 
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1160 ]   BOOST_INCLUDEDIR = 
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1162 ]   BOOST_LIBRARYDIR = 
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1164 ] _boost_TEST_VERSIONS = 1.65.1;1.65
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1263 ] location of version.hpp: C:/Boost/include/boost-1_65_1/boost/version.hpp
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1287 ] version.hpp reveals boost 1.65.1
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1373 ] guessed _boost_COMPILER = -mgw53
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1383 ] _boost_MULTITHREADED = -mt
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1427 ] _boost_RELEASE_ABI_TAG = -
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1429 ] _boost_DEBUG_ABI_TAG = -d
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1491 ] _boost_LIBRARY_SEARCH_DIRS_RELEASE = C:/Boost/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH_boost_LIBRARY_SEARCH_DIRS_DEBUG   = C:/Boost/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1641 ] Searching for FILESYSTEM_LIBRARY_RELEASE: boost_filesystem-mgw53-mt-1_65_1;boost_filesystem-mgw53-mt;boost_filesystem-mt-1_65_1;boost_filesystem-mt;boost_filesystem
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:380 ]  Boost_LIBRARY_DIR_RELEASE = C:/Boost/lib _boost_LIBRARY_SEARCH_DIRS_RELEASE = C:/Boost/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1692 ] Searching for FILESYSTEM_LIBRARY_DEBUG: boost_filesystem-mgw53-mt-d-1_65_1;boost_filesystem-mgw53-mt-d;boost_filesystem-mt-d-1_65_1;boost_filesystem-mt-d;boost_filesystem-mt;boost_filesystem
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:380 ]  Boost_LIBRARY_DIR_DEBUG = C:/Boost/lib _boost_LIBRARY_SEARCH_DIRS_DEBUG = C:/Boost/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1641 ] Searching for REGEX_LIBRARY_RELEASE: boost_regex-mgw53-mt-1_65_1;boost_regex-mgw53-mt;boost_regex-mt-1_65_1;boost_regex-mt;boost_regex
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:380 ]  Boost_LIBRARY_DIR_RELEASE = C:/Boost/lib _boost_LIBRARY_SEARCH_DIRS_RELEASE = C:/Boost/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1692 ] Searching for REGEX_LIBRARY_DEBUG: boost_regex-mgw53-mt-d-1_65_1;boost_regex-mgw53-mt-d;boost_regex-mt-d-1_65_1;boost_regex-mt-d;boost_regex-mt;boost_regex
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:380 ]  Boost_LIBRARY_DIR_DEBUG = C:/Boost/lib _boost_LIBRARY_SEARCH_DIRS_DEBUG = C:/Boost/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1641 ] Searching for THREAD_LIBRARY_RELEASE: boost_thread-mgw53-mt-1_65_1;boost_thread-mgw53-mt;boost_thread-mt-1_65_1;boost_thread-mt;boost_thread
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:380 ]  Boost_LIBRARY_DIR_RELEASE = C:/Boost/lib _boost_LIBRARY_SEARCH_DIRS_RELEASE = C:/Boost/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1692 ] Searching for THREAD_LIBRARY_DEBUG: boost_thread-mgw53-mt-d-1_65_1;boost_thread-mgw53-mt-d;boost_thread-mt-d-1_65_1;boost_thread-mt-d;boost_thread-mt;boost_thread
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:380 ]  Boost_LIBRARY_DIR_DEBUG = C:/Boost/lib _boost_LIBRARY_SEARCH_DIRS_DEBUG = C:/Boost/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1641 ] Searching for DATE_TIME_LIBRARY_RELEASE: boost_date_time-mgw53-mt-1_65_1;boost_date_time-mgw53-mt;boost_date_time-mt-1_65_1;boost_date_time-mt;boost_date_time
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:380 ]  Boost_LIBRARY_DIR_RELEASE = C:/Boost/lib _boost_LIBRARY_SEARCH_DIRS_RELEASE = C:/Boost/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1692 ] Searching for DATE_TIME_LIBRARY_DEBUG: boost_date_time-mgw53-mt-d-1_65_1;boost_date_time-mgw53-mt-d;boost_date_time-mt-d-1_65_1;boost_date_time-mt-d;boost_date_time-mt;boost_date_time
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:380 ]  Boost_LIBRARY_DIR_DEBUG = C:/Boost/lib _boost_LIBRARY_SEARCH_DIRS_DEBUG = C:/Boost/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1641 ] Searching for SYSTEM_LIBRARY_RELEASE: boost_system-mgw53-mt-1_65_1;boost_system-mgw53-mt;boost_system-mt-1_65_1;boost_system-mt;boost_system
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:380 ]  Boost_LIBRARY_DIR_RELEASE = C:/Boost/lib _boost_LIBRARY_SEARCH_DIRS_RELEASE = C:/Boost/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1692 ] Searching for SYSTEM_LIBRARY_DEBUG: boost_system-mgw53-mt-d-1_65_1;boost_system-mgw53-mt-d;boost_system-mt-d-1_65_1;boost_system-mt-d;boost_system-mt;boost_system
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:380 ]  Boost_LIBRARY_DIR_DEBUG = C:/Boost/lib _boost_LIBRARY_SEARCH_DIRS_DEBUG = C:/Boost/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1641 ] Searching for CHRONO_LIBRARY_RELEASE: boost_chrono-mgw53-mt-1_65_1;boost_chrono-mgw53-mt;boost_chrono-mt-1_65_1;boost_chrono-mt;boost_chrono
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:380 ]  Boost_LIBRARY_DIR_RELEASE = C:/Boost/lib _boost_LIBRARY_SEARCH_DIRS_RELEASE = C:/Boost/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1692 ] Searching for CHRONO_LIBRARY_DEBUG: boost_chrono-mgw53-mt-d-1_65_1;boost_chrono-mgw53-mt-d;boost_chrono-mt-d-1_65_1;boost_chrono-mt-d;boost_chrono-mt;boost_chrono
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:380 ]  Boost_LIBRARY_DIR_DEBUG = C:/Boost/lib _boost_LIBRARY_SEARCH_DIRS_DEBUG = C:/Boost/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1641 ] Searching for ATOMIC_LIBRARY_RELEASE: boost_atomic-mgw53-mt-1_65_1;boost_atomic-mgw53-mt;boost_atomic-mt-1_65_1;boost_atomic-mt;boost_atomic
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:380 ]  Boost_LIBRARY_DIR_RELEASE = C:/Boost/lib _boost_LIBRARY_SEARCH_DIRS_RELEASE = C:/Boost/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1692 ] Searching for ATOMIC_LIBRARY_DEBUG: boost_atomic-mgw53-mt-d-1_65_1;boost_atomic-mgw53-mt-d;boost_atomic-mt-d-1_65_1;boost_atomic-mt-d;boost_atomic-mt;boost_atomic
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:380 ]  Boost_LIBRARY_DIR_DEBUG = C:/Boost/lib _boost_LIBRARY_SEARCH_DIRS_DEBUG = C:/Boost/lib;NO_DEFAULT_PATH;NO_CMAKE_FIND_ROOT_PATH
    [ D:/InstallDir/CMake/share/cmake-3.10/Modules/FindBoost.cmake:1767 ] Boost_FOUND = 1
    Boost version: 1.65.1
    Found the following Boost libraries:
      filesystem
      regex
      thread
      date_time
      system
      chrono
      atomic
    [INFO] CMAKE_SOURCE_DIR      : D:/Projects/Chess/stockfish-8-src/stockfish-8-src/src
    [INFO] BOOST_ROOT                : D:/Libraries/boost_1_65_1/boost_1_65_1
    [INFO] BOOST_INCLUDEDIR       : D:/Libraries/boost_1_65_1/boost_1_65_1
    [INFO] CMAKE_INCLUDE_PATH   : 
    [INFO] CMAKE_LIBRARY_PATH   : 
    [INFO] CMAKE_VERSION            : 3.10
    [INFO] Current working directory: D:/Projects/Chess/stockfish-8-src/stockfish-8-src/src
    D:/InstallDir/Qt/Tools/mingw530_32/bin/mingw32-make.exe
    [INFO] Added arguments to CMAKE_BUILD_TOOL: D:/InstallDir/Qt/Tools/mingw530_32/bin/mingw32-make.exe
    Configuring done
    Generating done
    CMake Project was parsed successfully.
    

    which would be great if I could find the Makefile and build the project with it. Where is it stored? Does Qt make use of the CMakeLists.txt file?

    Going to the project's build settings I see that Qt calls cmake like:

    Build: cmake.exe --build . --target all
    

    How can I tell Qt to use the CMakeLists.txt file when building my project?


  • Lifetime Qt Champion

    Hi,

    Why don't you build also in Qt Creator ?

    If you want to do it from the command line, go to the shadow build folder of your project.



  • @SGaist said in Generating custom Makefiles in Qt:

    If you want to do it from the command line, go to the shadow build folder of your project.

    The build from Qt generates the following set of errors:

    In file included from D:\Projects\Chess\stockfish-8-src\stockfish-8-src\src\main.cpp:31:0:
    D:\Projects\Chess\stockfish-8-src\stockfish-8-src\src\util.h: In static member function 'static void Util::init(std::__cxx11::string)':
    D:\Projects\Chess\stockfish-8-src\stockfish-8-src\src\util.h:17:9: error: 'logging' has not been declared
             logging::add_file_log(logFileName);
             ^
    D:\Projects\Chess\stockfish-8-src\stockfish-8-src\src\util.h:18:9: error: 'logging' has not been declared
             logging::core::get()->set_filter
             ^
    D:\Projects\Chess\stockfish-8-src\stockfish-8-src\src\util.h:20:13: error: 'logging' has not been declared
                 logging::trivial::severity >= logging::trivial::info
                 ^
    D:\Projects\Chess\stockfish-8-src\stockfish-8-src\src\util.h:20:43: error: 'logging' has not been declared
                 logging::trivial::severity >= logging::trivial::info
                                               ^
    CMakeFiles\stockfish.dir\build.make:187: recipe for target 'CMakeFiles/stockfish.dir/main.cpp.obj' failed
    mingw32-make.exe[2]: *** [CMakeFiles/stockfish.dir/main.cpp.obj] Error 1
    CMakeFiles\Makefile2:66: recipe for target 'CMakeFiles/stockfish.dir/all' failed
    mingw32-make.exe[1]: *** [CMakeFiles/stockfish.dir/all] Error 2
    Makefile:82: recipe for target 'all' failed
    mingw32-make.exe: *** [all] Error 2
    22:03:32: The process "D:\InstallDir\CMake\bin\cmake.exe" exited with code 2.
    Error while building/deploying project Stockfish (kit: Desktop Qt 5.9.2 MinGW 32bit)
    When executing step "CMake Build"
    22:03:32: Elapsed time: 00:13.
    

    I have a file that uses boost and Qt's syntax highlighter shows that the boost header files cannot be found.

    Qt didn't create a shadow build folder (I created the project from existing sources).


  • Lifetime Qt Champion

    Where did you get the sources and where is logging coming from ?



  • @SGaist

    The sources are from github. The logging info is from Qt. I did manage to build and run stockfish (maybe because it's pure C++?) but otherwise I couldn't add any external includes/libraries (such as boost). Qt can't seem to generate a Makefile from the CMakeLists.txt file. When building this rule is, apparently, always used:

    Build: cmake.exe --build . --target all
    

  • Moderators

    @Sebi1729 said in Generating custom Makefiles in Qt:

    The logging info is from Qt

    It isn't:

    D:\Projects\Chess\stockfish-8-src\stockfish-8-src\src\util.h:17:9: error: 'logging' has not been declared
             logging::add_file_log(logFileName);
    

    How is this output related to Qt?



  • @jsulm

    You mean the actual code? It's the logger from boost:

    #include <boost/log/core.hpp>
    #include <boost/log/trivial.hpp>
    #include <boost/log/expressions.hpp>
    #include <boost/log/utility/setup/file.hpp>
    

    How is this output related to Qt?

    This is what I get when building (from Qt) using the above build configuration.


  • Lifetime Qt Champion

    Nothing Qt related here, it's CMake that you should take a look at.

    As the error message suggest the framework is not found, you have to pass it more information in order to find it.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.