How to set correctly from CMAKELIST the visual stu

2019-09-02 21:56发布

问题:

****Hello to everyone,

Because of the error messages , I will paste here, the post might look long but it’s really short!! I am working on a windows 7(64 bits), where I have to generate a c++ visual studio IDE with cmakeusing a library compiled with visual studio 10. But I want to work with visual studio 12! I have both visual studio 10 and 12 on my computer!

When I try to compile using the CMAKE-Gui setting Visual Studio 10 (Win64) as compiler:****

...

testCCompiler.c
1> 
1> testCCompiler.c
1>LINK : fatal error LNK1123: failure during conversion to COFF: file invalid or corrupt
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.84

CMake will not be able to correctly generate this project. Call Stack (most recent call first): CMakeLists.txt:16 (project) Configuring incomplete, errors occurred! See also ...

When I try to compile using the CMAKE-Gui setting Visual Studio 10(this one is probably 32bits) as compiler:

 testCCompiler.c


LINK : fatal error LNK1123: failure during conversion to COFF: file
invalid or corrupt





1>Build FAILED.
...

When I compile using Visual Studio 12(Win64), I get this error:

CMake Error: CMake was unable to find a build program corresponding to "Visual Studio 12 Win64". CMAKE_MAKE_PROGRAM is not set. You probably need to select a different build tool.
CMake Error: Could not find cmake module file: U:/Develop/CMAKE Builds/ADTF_PLUGINS_DATAFUSION111/CMakeFiles/2.8.12.2/CMakeCCompiler.cmake
CMake Error: Could not find cmake module file: U:/Develop/CMAKE Builds/ADTF_PLUGINS_DATAFUSION111/CMakeFiles/2.8.12.2/CMakeCXXCompiler.cmake
Configuring incomplete, errors occurred!

Only when I used the cmake setting Visual Studio 11(Win64) did it work, but then when I opened the solution in visual studio 12 and comlpiled there were a compiler conflict:

error LNK2038: mismatch detected for '_MSC_VER': value '1600' doesn't match value '1700' in cBaseFusionViewer.obj   U:\Develop\CMAKE Builds\[…]

I can change manually in visual studio the TOOLSET property from v110 to v100 but I’d like to do this automatically from cmake. I have tried the following lines without success:

set compiler visual studio 10

set(PLATFORM_WIN32_MSVC_TOOLSET v100 CACHE STRING "MSVC Platform toolset" FORCE)

set(PLATFORM_SUFFIX "-v100" CACHE STRING "" FORCE)

Herefore I have following two questions: - Why is there a listed working compiler Visual Studio 11(win64) in cmake when I have installed Visual Studio 12 and that one fails by generation of the solution with cmake!??? - How do I correctly set the toolset compiler v100 in cmake!???

Thanks for your support in advance!!