[CMake] using cmake on windows - query on existing targets
Bill Hoffman
bill.hoffman at kitware.com
Fri Jan 15 16:43:02 EST 2010
Chauhan, Vikas wrote:
>> 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.
>
This is normal. There is not target named build.
> 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
Works great.
>> 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.
> CMAKE_MAKE_PROGRAM:FILEPATH=CMAKE_MAKE_PROGRAM-NOTFOUND
Remove this CMakeCache.txt file, and re-run and it should work.
I would start with a clean build tree and source tree. If you have
ever run cmake in-source, clean your source tree so that it has no
generated stuff in it. Also, remove the entire build tree, then you
should be fine.
-Bill
More information about the CMake
mailing list