[Qt-creator] Project-specific make tool

Stephen Kelly steveire at gmail.com
Wed Mar 12 15:54:45 CET 2014


Daniel Teske wrote:

>> So, if the makefiles cause cmake to run any part of the build, it will
>> use nmake. Creator expects jom to be used. The solution is to tell cmake
>> to use jom.
>
> Can you demonstrate this in a example? We don't expect cmake to run make
> for us, and other things would break if cmake does that.

It would be user code that would cause it I think.

1) User code can invoke

 "${CMAKE_COMMAND} --build ${somedir}"

There is a built-in command for creating such command lines too:

 http://www.cmake.org/cmake/help/v3.0/command/build_command.html

It's not the wrong thing to do for non-trivial user buildsystems.

2) Code which runs a build will use the CMAKE_MAKE_PROGRAM:

 include(CTest)

 add_test(someproj_test ${CMAKE_CTEST_COMMAND}
   --build-and-test "${CMAKE_CURRENT_SOURCE_DIR}/subproj"
                    "${CMAKE_CURRENT_BINARY_DIR}/subproj"
   --build-generator "${CMAKE_GENERATOR}"
   --build-makeprogram "${CMAKE_MAKE_PROGRAM}"
   --build-project "subproj"
 )

This is done in CMake

 http://cmake.org/gitweb?p=cmake.git;a=blob;f=Tests/CMakeLists.txt;h=726e7902#l6

and in Qt

 https://qt.gitorious.org/qt/qtbase/source/3683bc97d:mkspecs/features/ctest_testcase_common.prf#L86

3) The ExternalProject module has special handling for makefile generators 
and seems to use $(MAKE), which seems to mean that jom is used to build 
external projects, so that's good.

 include(ExternalProject)
 ExternalProject_Add(subproj
     SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/subproj"
     INSTALL_COMMAND ""
 )

4) Any try_compile will use nmake, even though the main build uses jom:

 add_library(cmaketest lib.cpp)

 file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/tc_code.cpp" "
 int main(int argc, char** argv)
 {
     return 0;
 }
 ")
 try_compile(tc_result "${CMAKE_CURRENT_BINARY_DIR}/tc_code"
     "${CMAKE_CURRENT_BINARY_DIR}/tc_code.cpp"
   OUTPUT_VARIABLE tc_out
 )
 message("TC###########################\n${tc_out}")



These are probably not cases which will cause breakage anywhere, but I don't 
see any reason *not* to tell cmake which build tool to use.

Thanks,

Steve.





More information about the Qt-creator mailing list