[CMake] Help with non-standard use of CMake

frodak17 frodak17 at gmail.com
Tue Jan 1 20:48:55 EST 2019


On Tue, Jan 1, 2019 at 4:55 PM Donald MacQueen [|] <dmacq at instantiations.com>
wrote:

>
> On 1/1/2019 4:48 PM, frodak17 wrote:
>
>
>
> I'm trying to follow along but you are calling cmake to do the install and
> set everything up before you run ctest.
> And that the software was already built and packaged separately.
>
>
> No. CMakelists.txt does nothing but download the correct installer (32 or
> 64 bit) from our server, set a bunch of variables, and then run CTest.  I
> invoke the InstallShield installer from a command line in a CTest.
>
> There is no project, no make, no compile, no build. Just set a bunch of
> variables and run CTest.
>
> I think from what Kyle said I need to migrate(?) this to a script that can
> be called from CTest directly, e.g., ctest -D Experimental -S cdash.txt.
>
> Thanks for the reply.
>
>
The point I was trying to make is that the mere existence of a
CMakeLists.txt is enough for the implicit try_compile()

For example use the following lines:

cmake_minimum_required(VERSION 2.8.8)
> if(CMAKE_VERSION VERSION_GREATER "3.1")
>    cmake_policy(SET CMP0054 NEW)
> endif()
>

Now go into the build folder and type `cmake ..` and it will default with
an implicit project with C and C++ languages enabled.
Then it will use the default generator and try to build the sample project
to verify a working build system.
After this it will continue to process the rest of the script.

Now it may be that I misunderstood which log you were referring to that
contained the error.
But typically any time `cmake` is used (unless used with -P or -E) it will
do an implicit build unless something like "project( empty LANGUAGES NONE
)" is used.

BTW:

> if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "64")
>      set (vasttst_isX86_OS FALSE)
>      set (vasttst_OsBitness 64)
> endif()
>      set (vasttst_isX86_OS TRUE)
>      set (vasttst_OsBitness 86)
> endif ()

has a syntax error, it should be else()

As for the error in question

> The system cannot find the file specified.
> CMake Error: Generator: execution of make failed.
> Make command was: "nmake" "/nologo" "-i"
>

This error is generated when "cmake --build" is used.
Using a CMakeLists.txt file with no targets, like the one above, then the
following steps can be used to generate the error.

1) Open a VS Native Tools Command shell
2) Run:  cmake -G"NMake Makefiles" ..\no_targets
-- This is enough to setup the cache to a working nmake
3) Open a regular cmd.exe shell
4) Run: cmake --build . -- -i
The system cannot find the file specified
CMake Error: Generator: execution of make failed. Make command was: "nmake"
"/nologo" "-i"

As for suppressing these steps the only way I am aware of them occurring is
if the test itself is trying to build either through issuing a `ctest
--test-and-build` or `cmake --build`.
Doesn't the log file mention which test generated the error?  For example
when running the tests for cmake there is a file called LastTest.log.  It
contains details on all the tests and their results.

I don't think simply running a script is sufficient to use ctest because it
seems to need a configured build directory that contains the test
configuration file before running the tests.

--
F
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190101/b8820eb8/attachment-0001.html>


More information about the CMake mailing list