Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: CMake doesn't work for VS 2013  (Read 23972 times)

0 Members and 1 Guest are viewing this topic.

nbd

  • Newbie
  • *
  • Posts: 14
    • View Profile
CMake doesn't work for VS 2013
« on: March 11, 2014, 07:42:24 pm »
I'm trying to create a VS 2013 project with CMake, following this instruction:

http://www.sfml-dev.org/tutorials/2.1/compile-with-cmake.php

but keep getting the error message that

Quote
  The C compiler "E:/Program Files (x86)/Microsoft Visual Studio
  12.0/VC/bin/cl.exe" is not able to compile a simple test program.

The error that compiler (more precisely - linker) gives is:

Quote
LINK : fatal error LNK1104: cannot open file 'kernel32.lib'

I added the path to the 'kernel32.lib' file to the PATH variable from the command line with the commands

Quote
set PATH = %PATH%;  E:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A

and

Quote
set PATH = %PATH%;  E:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib

But keep receiving the same error. Do I need to specify somewhere the path to the 'kernel32.lib'?
« Last Edit: March 11, 2014, 07:44:33 pm by nbd »

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: CMake doesn't work for VS 2013
« Reply #1 on: March 11, 2014, 08:15:20 pm »
Did you install Microsoft Visual Studio 2013 Express Edition? Also make sure you're running the latest version of CMake. If so, you should be able to use it with CMake without further parameters or anything. Just call CMake with cmake path/to/source and it should create a VS 2013 project by default. If you've got the SDK only, you might have to use the toolset shortcut from the start menu group to open the "developer console", which will have all the proper paths being set.

nbd

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: CMake doesn't work for VS 2013
« Reply #2 on: March 11, 2014, 09:06:44 pm »
Mario

Yes, I'm using the Express edition. The message that kernel32.lib is not found happens if I choose the option in the CMake GUI "Specify the native compilers" and specify the cl.exe.

If I don't change or specify any settings and call CMake with default settings, then I get the messages that

Quote
The C compiler identification is unknown

and

Quote
The CXX compiler identification is unknown

The CMake log file gives the following details:

Quote
Build started 3/12/2014 11:21:17 PM.
Project "L:\prg\libsrc\SFML\SFML-2.1_build_Debug\CMakeFiles\2.8.12.2\CompilerIdC\CompilerIdC.vcxproj" on node 1 (default targets).
L:\prg\libsrc\SFML\SFML-2.1_build_Debug\CMakeFiles\2.8.12.2\CompilerIdC\CompilerIdC.vcxproj(14,3): error MSB4019: The imported project "L:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

Also among the CMake's error message there is a message that the "architecture is not supported":

Quote
CMake Error: Internal CMake error, TryCompile configure of cmake failed
Check size of void* - failed
CMake Error at cmake/Config.cmake:13 (message):
  Unsupported architecture

I checked the Config.cmake in the SFML directory and the line 13 is in the following block:

    check_type_size(void* SIZEOF_VOID_PTR)
    if("${SIZEOF_VOID_PTR}" STREQUAL "4")
        set(ARCH_32BITS 1)
    elseif("${SIZEOF_VOID_PTR}" STREQUAL "8")
        set(ARCH_64BITS 1)
    else()
        message(FATAL_ERROR "Unsupported architecture")
        return()
    endif()

It seems that when CMake checks the size of the 'void' pointer, this size is not equal to 4 or 8 bytes. How this can happen? (I'm using the x64 Windows 7 on 32-bit Intel processor machine. )

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: CMake doesn't work for VS 2013
« Reply #3 on: March 11, 2014, 09:11:20 pm »
Your issue isn't with the SFML cmake file, but has something to do with your environment. It would seem as if you got something screwed up with your install, try disabling any antivirus and running cmake as an administrator to see if that helps. If all else fails uninstall VS 2013 and reinstall.  ;)

It seems that when CMake checks the size of the 'void' pointer, this size is not equal to 4 or 8 bytes. How this can happen?

Because CMake itself can't find a valid compiler.

Quote
(I'm using the x64 Windows 7 on 32-bit Intel processor machine. )

That doesn't make much sense because if your CPU doesn't support 64 bit it would be impossible to run a 64 bit OS.  :P
« Last Edit: March 11, 2014, 09:14:06 pm by zsbzsb »
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

nbd

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: CMake doesn't work for VS 2013
« Reply #4 on: March 11, 2014, 09:22:58 pm »
zsbzsb

I have a totally fresh installation of Windows and VS (both are installed yesterday) and I don't have even any antivirus or third party firewall software intalled. All the exe files in the CMake/bin directory have the "Run as administrator" flag set and I tried to ran CMake with UAC turned off. The result is the same. :(

The CMake version is the latest one for Windows found on the CMake site: cmake-2.8.12.2-win32-x86

Mario

  • SFML Team
  • Hero Member
  • *****
  • Posts: 879
    • View Profile
Re: CMake doesn't work for VS 2013
« Reply #5 on: March 11, 2014, 09:27:19 pm »
What happens if you tell CMake to use the default compiler toolchain (i.e. don't specify cl.exe or any other file)?

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: CMake doesn't work for VS 2013
« Reply #6 on: March 11, 2014, 09:29:18 pm »
The last thing I can think of is that you installed the wrong VS 2013 express version. Make sure you have Visual Studio 2013 Express Desktop installed. Keyword here is "Desktop"  :)
« Last Edit: March 11, 2014, 09:30:54 pm by zsbzsb »
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

nbd

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: CMake doesn't work for VS 2013
« Reply #7 on: March 11, 2014, 10:11:27 pm »
What happens if you tell CMake to use the default compiler toolchain (i.e. don't specify cl.exe or any other file)?

With default compiler toolchain I get six or seven error messages in the CMake GUI about unrecognized compilers and unsupported architecture. In the CMake output log file the first error message is the following:

Quote
Compiling the C compiler identification source file "CMakeCCompilerId.c" failed.
Compiler: 
Build flags:
Id flags:

The output was:
1
Microsoft (R) Build Engine version 12.0.21005.1
[Microsoft .NET Framework, version 4.0.30319.18408]
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 3/12/2014 11:58:08 PM.
Project "L:\prg\libsrc\SFML\SFML-2.1_build_Debug\CMakeFiles\2.8.12.2\CompilerIdC\CompilerIdC.vcxproj" on node 1 (default targets).
PrepareForBuild:
  Creating directory "Debug\".
E:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(355,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid version number. [L:\prg\libsrc\SFML\SFML-2.1_build_Debug\CMakeFiles\2.8.12.2\CompilerIdC\CompilerIdC.vcxproj]
  Creating directory "Debug\CompilerIdC.tlog\".
InitializeBuildStatus:
  Creating "Debug\CompilerIdC.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
  E:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\CL.exe /c /nologo /W0 /WX- /Od /Oy- /D _MBCS /Gm- /EHsc /RTC1 /MDd /GS /fp:precise /Zc:wchar_t /Zc:forScope /Fo"Debug\\" /Fd"Debug\vc120.pdb" /Gd /TC /analyze- /errorReport:queue CMakeCCompilerId.c
  CMakeCCompilerId.c
Link:
  E:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\link.exe /ERRORREPORT:QUEUE /OUT:".\CompilerIdC.exe" /INCREMENTAL:NO /NOLOGO kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /MANIFEST /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /manifest:embed /PDB:".\CompilerIdC.pdb" /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:".\CompilerIdC.lib" /MACHINE:X86 /SAFESEH Debug\CMakeCCompilerId.obj
LINK : fatal error LNK1181: cannot open input file 'kernel32.lib' [L:\prg\libsrc\SFML\SFML-2.1_build_Debug\CMakeFiles\2.8.12.2\CompilerIdC\CompilerIdC.vcxproj]
Done Building Project "L:\prg\libsrc\SFML\SFML-2.1_build_Debug\CMakeFiles\2.8.12.2\CompilerIdC\CompilerIdC.vcxproj" (default targets) -- FAILED.

Build FAILED.

I guess it is needed to set some environment variable specifying the path to kernel32.lib. The PATH variable contains that path, but it doesn't help. Maybe it's some variable related to the Windows SDK path.
« Last Edit: March 11, 2014, 10:17:15 pm by nbd »

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: CMake doesn't work for VS 2013
« Reply #8 on: March 11, 2014, 10:17:05 pm »
Is it possible to run the following code in a blank project?

#include <iostream>

int main()
{
  std::cout << "Hello World!";
}
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

nbd

  • Newbie
  • *
  • Posts: 14
    • View Profile
Re: CMake doesn't work for VS 2013
« Reply #9 on: March 11, 2014, 10:33:02 pm »
zsbzsb,

yes, it's possible and all my projects compile just fine. But the fresh installation of VS 2013 on 64-bit Windows has some issues with the paths to Windows SDK:

http://stackoverflow.com/questions/3599079/windowssdkdir-is-not-set-correctly-in-visual-studio-2010

For my projects I just specified the SDK path in the VS Directories. But the CMake apparently doesn't check the internal VS configuration files and checks either some environment variable or some registry key. (The registry keys mentioned in the link above ( on stackoverflow.com ) are present on my system and contain correct paths.)

F2CPP

  • Newbie
  • *
  • Posts: 14
    • View Profile
    • StackOverflow
Re: CMake doesn't work for VS 2013
« Reply #10 on: April 22, 2014, 10:08:47 pm »
sorry if this has been mentioned, but are you starting cmake gui from the command line (as opposed to stand-alone from shortcut, which may not work)?

didii

  • Full Member
  • ***
  • Posts: 122
    • View Profile
Re: CMake doesn't work for VS 2013
« Reply #11 on: April 23, 2014, 01:15:00 pm »
I might have missed it, but have you installed a 32 or 64-bit of Visual Studios? Regardless of your system, you should choose the 32-bit version.