[CMake] using cmake on windows - query on existing targets

Chauhan, Vikas vikas.chauhan at anritsu.com
Fri Jan 15 16:26:13 EST 2010


> Can you try this:
> 
> 
> 1. Create a new directory:
> mkdir foo
> 2. Create a CMakeLists.txt file in foo
> project(foo)
> add_library(foo bar.c)
> 
> Create an empty file bar.c.
> 
> 3. Create a build directory under foo:
> mkdir build
> 
> 4. run cmake
> 
> cd build
> cmake -G"NMake Makefiles" ..
> 

Great, it works this time and finds the compiler. However, I do not
understand why it does not work for my project directory?

Following is the output:

C:\cmaketest\foo\build>cmake -G"NMake Makefiles" ..
-- The C compiler identification is MSVC
-- The CXX compiler identification is MSVC
-- Check for CL compiler version
-- Check for CL compiler version - 1500
-- Check if this is a free VC compiler
-- Check if this is a free VC compiler - no
-- Check CL platform
-- Check CL platform - 32 bit
-- Check for working C compiler: C:/Program Files/Microsoft Visual
Studio 9.0/VC/bin/cl.exe
-- Check for working C compiler: C:/Program Files/Microsoft Visual
Studio 9.0/VC/bin/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual
Studio 9.0/VC/bin/cl.exe
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual
Studio 9.0/VC/bin/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: C:/cmaketest/foo/build

C:\cmaketest\foo\build>dir
 Volume in drive C has no label.
 Volume Serial Number is 1099-BF1F

 Directory of C:\cmaketest\foo\build

15/01/2010  21:19    <DIR>          .
15/01/2010  21:19    <DIR>          ..
15/01/2010  21:19            11,759 CMakeCache.txt
15/01/2010  21:19    <DIR>          CMakeFiles
15/01/2010  21:19             1,450 cmake_install.cmake
15/01/2010  21:19             4,959 Makefile
               3 File(s)         18,168 bytes
               3 Dir(s)  195,137,568,768 bytes free

C:\cmaketest\foo\build>nmake build

Microsoft (R) Program Maintenance Utility Version 9.00.21022.08
Copyright (C) Microsoft Corporation.  All rights reserved.

NMAKE : fatal error U1073: don't know how to make 'build'
Stop.

C:\cmaketest\foo\build>nmake

Microsoft (R) Program Maintenance Utility Version 9.00.21022.08
Copyright (C) Microsoft Corporation.  All rights reserved.

Scanning dependencies of target foo
[100%] Building C object CMakeFiles/foo.dir/bar.c.obj
bar.c
Linking C static library foo.lib
[100%] Built target foo
> Also, is there a CMakeCache.txt file in
> C:/Work/PCT_LTE/Hercules/CID/MapperGenerator?
> 
> What is in the CMakeCache.txt in
> C:\Work\PCT_LTE\Hercules\CID\MapperGenerator\build_nmake?
> 

Yes, there is a CMakeCache.txt in this directory. The contents are as
below(Sorry, it is a big file):
# This is the CMakeCache file.
# For build in directory:
c:/Work/PCT_LTE/Hercules/CID/MapperGenerator/build_nmake
# It was generated by CMake: C:/Program Files/CMake 2.8/bin/cmake.exe
# You can edit this file to change values found and used by cmake.
# If you do not want to change any of the values, simply exit the
editor.
# If you do want to change a value, simply edit, save, and exit the
editor.
# The syntax for the file is as follows:
# KEY:TYPE=VALUE
# KEY is the name of a variable in the cache.
# TYPE is a hint to GUI's for the type of VALUE, DO NOT EDIT TYPE!.
# VALUE is the current value for the KEY.

########################
# EXTERNAL cache entries
########################

//Path to a program.
CMAKE_MAKE_PROGRAM:FILEPATH=CMAKE_MAKE_PROGRAM-NOTFOUND

//Value Computed by CMake
CMAKE_PROJECT_NAME:STATIC=MapperGenerator

//If true, cmake will use relative paths in makefiles and projects.
CMAKE_USE_RELATIVE_PATHS:BOOL=OFF

//Value Computed by CMake
MapperGenerator_BINARY_DIR:STATIC=C:/Work/PCT_LTE/Hercules/CID/MapperGen
erator/build_nmake

//Value Computed by CMake
MapperGenerator_SOURCE_DIR:STATIC=C:/Work/PCT_LTE/Hercules/CID/MapperGen
erator


########################
# INTERNAL cache entries
########################

//This is the directory where this CMakeCache.txt was created
CMAKE_CACHEFILE_DIR:INTERNAL=c:/Work/PCT_LTE/Hercules/CID/MapperGenerato
r/build_nmake
//Major version of cmake used to create the current loaded cache
CMAKE_CACHE_MAJOR_VERSION:INTERNAL=2
//Minor version of cmake used to create the current loaded cache
CMAKE_CACHE_MINOR_VERSION:INTERNAL=8
//Patch version of cmake used to create the current loaded cache
CMAKE_CACHE_PATCH_VERSION:INTERNAL=0
//Path to CMake executable.
CMAKE_COMMAND:INTERNAL=C:/Program Files/CMake 2.8/bin/cmake.exe
//Path to cpack program executable.
CMAKE_CPACK_COMMAND:INTERNAL=C:/Program Files/CMake 2.8/bin/cpack.exe
//Path to ctest program executable.
CMAKE_CTEST_COMMAND:INTERNAL=C:/Program Files/CMake 2.8/bin/ctest.exe
//Path to cache edit program executable.
CMAKE_EDIT_COMMAND:INTERNAL=C:/Program Files/CMake 2.8/bin/cmake-gui.exe
//Start directory with the top level CMakeLists.txt file for this
// project
CMAKE_HOME_DIRECTORY:INTERNAL=C:/Work/PCT_LTE/Hercules/CID/MapperGenerat
or
//ADVANCED property for variable: CMAKE_MAKE_PROGRAM
CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1
//number of local generators
CMAKE_NUMBER_OF_LOCAL_GENERATORS:INTERNAL=1
//Path to CMake installation.
CMAKE_ROOT:INTERNAL=C:/Program Files/CMake 2.8/share/cmake-2.8
//Suppress Warnings that are meant for the author of the CMakeLists.txt
// files.
CMAKE_SUPPRESS_DEVELOPER_WARNINGS:INTERNAL=FALSE
//ADVANCED property for variable: CMAKE_USE_RELATIVE_PATHS
CMAKE_USE_RELATIVE_PATHS-ADVANCED:INTERNAL=1



More information about the CMake mailing list