[CMake] BasicRuntimeChecks inside CompilerId/VS-10.vcxproj.in

CACHET Bertrand bertrand.cachet at gmail.com
Thu Nov 20 05:18:27 EST 2014


Hello,

I would like to add support for INtime (v6) platform (RTOS for Windows).

I add these variables to my CMakeLists.txt project:
    SET(CMAKE_SYSTEM_NAME INtime)
    SET(CMAKE_GENERATOR_PLATFORM INtime)

I generated a platform/INtime.cmake file (attach to this email).

When trying to generate my build environment with CMake, I got an error
when CMake try to detect C/CXX Compilers: "/NO CMAKE_C_COMPILER could be
found/" due to compilation error: "/CMakeCCompilerId.obj : error
LNK2001: unresolved external symbol __RTC_InitBase/".
This compilation error is due to /RTC1 compilation flag usage.
Presence of this compilation flag is due to
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> in
CompilerId/VS-10.vcxproj.in template.

Is there any reason to always perform this RunTime Check when looking
for valid compiler on Visual Studio ?


Thanks for your answer

Sincerely

Bertrand
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20141120/eaf0f806/attachment.html>
-------------- next part --------------

IF(__INTIME)
  RETURN()
ENDIF()
SET(__INTIME 1)

SET(WIN32 0)

SET(MSVC 1)

SET(CMAKE_GENERATOR_PLATFORM "INtime")

set(CMAKE_STATIC_LIBRARY_PREFIX "")
set(CMAKE_STATIC_LIBRARY_SUFFIX ".lib")
set(CMAKE_SHARED_LIBRARY_PREFIX "")
set(CMAKE_SHARED_LIBRARY_SUFFIX ".rsl")
set(CMAKE_IMPORT_LIBRARY_PREFIX "")
set(CMAKE_IMPORT_LIBRARY_SUFFIX ".lib")
set(CMAKE_EXECUTABLE_SUFFIX ".rta")
set(CMAKE_LINK_LIBRARY_SUFFIX ".lib")
set(CMAKE_DL_LIBS "")

set(CMAKE_FIND_LIBRARY_PREFIXES "")
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib")

set(CMAKE_LINK_LIBRARY_FLAG "")
set(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:")

set(CMAKE_BUILD_TYPE_INIT Debug)

FILE(TO_CMAKE_PATH $ENV{PROGRAMFILES}/INtime INTIME_PATH)

INCLUDE_DIRECTORIES(${INTIME_PATH}/rt/include/network7)
INCLUDE_DIRECTORIES(${INTIME_PATH}/rt/include/cpp)
INCLUDE_DIRECTORIES(${INTIME_PATH}/rt/include)
LINK_DIRECTORIES(${INTIME_PATH}/rt/lib)
SET(CMAKE_C_STANDARD_LIBRARIES_INIT rtppd.lib cpplib.lib) # For C++ support
SET(CMAKE_C_STANDARD_LIBRARIES_INIT ${CMAKE_C_STANDARD_LIBRARIES_INIT} rt.lib pcibus.lib netlib.lib clib.lib vshelper.lib)
SET(CMAKE_C_STANDARD_LIBRARIES_INIT ${CMAKE_C_STANDARD_LIBRARIES_INIT} iwin32.lib) # Win32 API support

SET(CMAKE_CXX_STANDARD_LIBRARIES_INIT ${CMAKE_C_STANDARD_LIBRARIES_INIT})

SET(CMAKE_EXE_LINKER_FLAGS_INIT "/NODEFAULTLIB /MANIFEST:NO /INCREMENTAL:NO /ASSEMBLYDEBUG:DISABLE /VERSION:21076.20053 /SAFESEH:NO")
SET(CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /DEBUG")
SET(CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT})
SET(CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT})
SET(CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT})
SET(CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT})
SET(CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT})
SET(CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT})
SET(CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT})

MACRO(INtime_compiler_MSVC lang)
  # /X        => Do not use default libraries
  # /TP       => Compile for C++
  # /MT       => Multithreaded lib
  # /EHa      => Enable C++ Exceptions with SEH
  # /GR       => Enable Run-Time Type Information (needed by libjson-rpc)
  # /Od       => No optimization
  # /Gy-      => Disable Funtion-Leve Linking
  # /openmp-  => Disable OpenMP
  SET(CMAKE_${lang}_FLAGS_INIT "/X /MT /EHa /GR /Od /Gy- /openmp- /GF -D__C99__ -D__INTIME__ -DVS7_CPP -D_HAS_NAMESPACE -DEC_INTIME_VERSION=400 /W3")
  SET(CMAKE_${lang}_FLAGS_DEBUG_INIT "/Zi -D_DEBUG")
ENDMACRO()

INtime_compiler_MSVC(C)
INtime_compiler_MSVC(CXX)
-------------- next part --------------
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.31101.0
[Microsoft .NET Framework, version 4.0.30319.18444]
Copyright (C) Microsoft Corporation. All rights reserved.

Build started 20.11.2014 11:09:46.
Project "C:\Users\bca\Desktop\test_build\build\CMakeFiles\3.1.0-rc2\CompilerIdC\CompilerIdC.vcxproj" on node 1 (default targets).
PrepareForBuild:
  Creating directory "Debug\".
  Creating directory "Debug\CompilerIdC.tlog\".
InitializeBuildStatus:
  Creating "Debug\CompilerIdC.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
  C:\Program Files\Microsoft Visual Studio 12.0\VC\bin\CL.exe /c /I"C:\Program Files\INtime\rt\include\network7" /I"C:\Program Files\INtime\rt\include" /nologo /W0 /WX- /Od /Oy- /D _DEBUG /D __C99__ /D __INTIME__ /X /GF /Gm- /EHa /RTC1 /MDd /GS /Gy- /fp:precise /fp:except- /Zc:wchar_t /Zc:forScope /GR- /openmp- /Fo"Debug\\" /Fd"Debug\vc120.pdb" /Gd /TC /analyze- /errorReport:prompt CMakeCCompilerId.c
  CMakeCCompilerId.c
Link:
  C:\Program Files\Microsoft Visual Studio 12.0\VC\bin\link.exe /ERRORREPORT:PROMPT /OUT:".\CompilerIdC.rta" /VERSION:"21076.20052" /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\Program Files\INtime\rt\lib" rt.lib pcibus.lib netlib.lib clib.lib vshelper.lib rmxiff3m.lib /NODEFAULTLIB /MANIFEST:NO /PDB:".\CompilerIdC.pdb" /ASSEMBLYDEBUG:DISABLE /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:".\CompilerIdC.lib" /MACHINE:X86 /SAFESEH:NO /SAFESEH:NO Debug\CMakeCCompilerId.obj
CMakeCCompilerId.obj : error LNK2001: unresolved external symbol __RTC_InitBase [C:\Users\bca\Desktop\test_build\build\CMakeFiles\3.1.0-rc2\CompilerIdC\CompilerIdC.vcxproj]
CMakeCCompilerId.obj : error LNK2001: unresolved external symbol __RTC_Shutdown [C:\Users\bca\Desktop\test_build\build\CMakeFiles\3.1.0-rc2\CompilerIdC\CompilerIdC.vcxproj]
.\CompilerIdC.rta : fatal error LNK1120: 2 unresolved externals [C:\Users\bca\Desktop\test_build\build\CMakeFiles\3.1.0-rc2\CompilerIdC\CompilerIdC.vcxproj]
Done Building Project "C:\Users\bca\Desktop\test_build\build\CMakeFiles\3.1.0-rc2\CompilerIdC\CompilerIdC.vcxproj" (default targets) -- FAILED.

Build FAILED.

"C:\Users\bca\Desktop\test_build\build\CMakeFiles\3.1.0-rc2\CompilerIdC\CompilerIdC.vcxproj" (default target) (1) ->
(Link target) -> 
  CMakeCCompilerId.obj : error LNK2001: unresolved external symbol __RTC_InitBase [C:\Users\bca\Desktop\test_build\build\CMakeFiles\3.1.0-rc2\CompilerIdC\CompilerIdC.vcxproj]
  CMakeCCompilerId.obj : error LNK2001: unresolved external symbol __RTC_Shutdown [C:\Users\bca\Desktop\test_build\build\CMakeFiles\3.1.0-rc2\CompilerIdC\CompilerIdC.vcxproj]
  .\CompilerIdC.rta : fatal error LNK1120: 2 unresolved externals [C:\Users\bca\Desktop\test_build\build\CMakeFiles\3.1.0-rc2\CompilerIdC\CompilerIdC.vcxproj]

    0 Warning(s)
    3 Error(s)

Time Elapsed 00:00:03.04


Compiling the CXX compiler identification source file "CMakeCXXCompilerId.cpp" failed.
Compiler:  
Build flags: 
Id flags: 

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

Build started 20.11.2014 11:09:50.
Project "C:\Users\bca\Desktop\test_build\build\CMakeFiles\3.1.0-rc2\CompilerIdCXX\CompilerIdCXX.vcxproj" on node 1 (default targets).
PrepareForBuild:
  Creating directory "Debug\".
  Creating directory "Debug\CompilerIdCXX.tlog\".
InitializeBuildStatus:
  Creating "Debug\CompilerIdCXX.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
  C:\Program Files\Microsoft Visual Studio 12.0\VC\bin\CL.exe /c /I"C:\Program Files\INtime\rt\include\network7" /I"C:\Program Files\INtime\rt\include" /nologo /W0 /WX- /Od /Oy- /D _DEBUG /D __C99__ /D __INTIME__ /X /GF /Gm- /EHa /RTC1 /MDd /GS /Gy- /fp:precise /fp:except- /Zc:wchar_t /Zc:forScope /GR- /openmp- /Fo"Debug\\" /Fd"Debug\vc120.pdb" /Gd /TP /analyze- /errorReport:prompt CMakeCXXCompilerId.cpp
  CMakeCXXCompilerId.cpp
Link:
  C:\Program Files\Microsoft Visual Studio 12.0\VC\bin\link.exe /ERRORREPORT:PROMPT /OUT:".\CompilerIdCXX.rta" /VERSION:"21076.20052" /INCREMENTAL:NO /NOLOGO /LIBPATH:"C:\Program Files\INtime\rt\lib" rt.lib pcibus.lib netlib.lib clib.lib vshelper.lib rmxiff3m.lib /NODEFAULTLIB /MANIFEST:NO /PDB:".\CompilerIdCXX.pdb" /ASSEMBLYDEBUG:DISABLE /SUBSYSTEM:CONSOLE /TLBID:1 /DYNAMICBASE /NXCOMPAT /IMPLIB:".\CompilerIdCXX.lib" /MACHINE:X86 /SAFESEH:NO /SAFESEH:NO Debug\CMakeCXXCompilerId.obj
CMakeCXXCompilerId.obj : error LNK2001: unresolved external symbol __RTC_InitBase [C:\Users\bca\Desktop\test_build\build\CMakeFiles\3.1.0-rc2\CompilerIdCXX\CompilerIdCXX.vcxproj]
CMakeCXXCompilerId.obj : error LNK2001: unresolved external symbol __RTC_Shutdown [C:\Users\bca\Desktop\test_build\build\CMakeFiles\3.1.0-rc2\CompilerIdCXX\CompilerIdCXX.vcxproj]
.\CompilerIdCXX.rta : fatal error LNK1120: 2 unresolved externals [C:\Users\bca\Desktop\test_build\build\CMakeFiles\3.1.0-rc2\CompilerIdCXX\CompilerIdCXX.vcxproj]
Done Building Project "C:\Users\bca\Desktop\test_build\build\CMakeFiles\3.1.0-rc2\CompilerIdCXX\CompilerIdCXX.vcxproj" (default targets) -- FAILED.

Build FAILED.

"C:\Users\bca\Desktop\test_build\build\CMakeFiles\3.1.0-rc2\CompilerIdCXX\CompilerIdCXX.vcxproj" (default target) (1) ->
(Link target) -> 
  CMakeCXXCompilerId.obj : error LNK2001: unresolved external symbol __RTC_InitBase [C:\Users\bca\Desktop\test_build\build\CMakeFiles\3.1.0-rc2\CompilerIdCXX\CompilerIdCXX.vcxproj]
  CMakeCXXCompilerId.obj : error LNK2001: unresolved external symbol __RTC_Shutdown [C:\Users\bca\Desktop\test_build\build\CMakeFiles\3.1.0-rc2\CompilerIdCXX\CompilerIdCXX.vcxproj]
  .\CompilerIdCXX.rta : fatal error LNK1120: 2 unresolved externals [C:\Users\bca\Desktop\test_build\build\CMakeFiles\3.1.0-rc2\CompilerIdCXX\CompilerIdCXX.vcxproj]

    0 Warning(s)
    3 Error(s)

Time Elapsed 00:00:01.14




More information about the CMake mailing list