How can I get CMAKE to generate a VS2013 project with Character Set set to Not Set so that it uses SBCS and not Unicode nor MBCS?
My CMAKE scrip is not defining UNICODE nor MBSC and yet the vcxproj generated still has the following in it:
MultiByte
This bug report from 2011 seems to indicate it was then solved for VS2010, but it does not seem to work for VS2013, or there something I'm missing.
https://public.kitware.com/Bug/print_bug_page.php?bug_id=12189
I have now managed to generate a SBCS (ASCII) project by adding definition _SBCS via add_definitions(). Just removing _MBCS via remove_definitions() was not sufficient to do it.
Related
So I was running a project in Qt creator which was going relatively ok, where I needed to generate some protobuf files and link against them. So I used conan:
# conan
if(NOT EXISTS "${CMAKE_BINARY_DIR}/conan.cmake")
message(STATUS "Downloading conan.cmake from https://github.com/conan-io/cmake-conan")
file(DOWNLOAD "https://raw.githubusercontent.com/conan-io/cmake-conan/master/conan.cmake" "${CMAKE_BINARY_DIR}/conan.cmake")
endif()
include(${CMAKE_BINARY_DIR}/conan.cmake)
conan_cmake_run(CONANFILE conanfile.txt
BASIC_SETUP
CMAKE_TARGETS
BUILD missing
)
And then
find_package(protobuf REQUIRED)
PROTOBUF_GENERATE_CPP(proto_h proto_c ${proto_files})
and then added those to "add_executable".
Everything worked. Until I had to port this to Visual studio, where no files are being generated, and it does not seem like any custom build step related to Protobuf generation was added.
I can't understand where is the issue. Also, CmakeGui was not able to find default protobuf related variables for some reason (Protobuf_LIBRARY_DEBUG-NOTFOUND etc.) but it was configured with no errors nonetheless (and PROTOBUF_GENERATE_CPP gave me file names to add the executable and it didn't swear that It can't find them = It should have found the protoc target to use it in its proto generation task).
So at this point I am out of Ideas and so frustrated because it seems that I have to resort to a manual protobuf download/install/search which might not even work=(
Can someone give an idea why such things happen? Why QtCreator is perfectly capable of running CMake scripts while Visual studio files generated by the same CMake GUI the QtCreator has, cant?
UPDATE: Weirdly enough, after I opend CmakeLists in Visual studio and used x64-Configuration, everything worked. Although I had to manually type CMAKE_PREFIX_PATH
Does it mean CmakeGui does not generate well?
I have a .net standard 2.0 class library. I have both VS 2017 and VS 2017 preview (for net core 2.0) installed.
I am trying to run docfx to generate documentation for my library.
I first faced an issue where I got the following message:
c:\docfx\Sdks\Microsoft.NET.Sdk\Sdk\Sdk.props
It appeared this was because when docfx ran MSBuild it could not find the dot net core 2.0 preview SDK. I found this could be fixed by creating an environment variable called MSBuildDSKsPath and setting it to the appropriate value. That got me past the above error and now I'm stuck with this error:
The imported project "C:\Program Files (x86)\MSBuild\2.0\Microsoft.Common.props" was not found.
This is coming from the Sdk.props file because in that file is this reference:
The MSBuildExtensionsPath value is right, but is appears the MSBuildToolsVersion is wrong. It should be 14 or 15 (not sure which, but those are what I have installed).
I tried a few things. I tried setting the MSBuildToolsVersion in the docfx.json file, and I also tried setting an MSBuildToolsVersion environment variable. Neither work.
Any suggestions on how to get this to run?
There's an issue tracking this. Current workaround is to set env.MSBuildSDKsPath to the right place, e.g. $ set MSBuildSDKsPath=C:\Program Files\dotnet\sdk\1.0.0-rc4-004771\Sdks
maybe set the ToolsVersion in csproj file can work
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="14.0">
the version value must be available
I'm trying to do this in Windows using Git CMD
C:\Users\Ove\paho>git clone https://github.com/eclipse/paho.mqtt.c.git
C:\Users\Ove\paho>cd org.eclipse.paho.mqtt.c.git
C:\Users\Ove\paho>msbuild "Windows Build\Paho C MQTT APIs.sln" /p:Configuration=Release
I'm stuck at msbuild where it repeats a series of errors:
'openssl/ssl.h': No such file or directory
I've installed openssl and there is an environment variable set up in:
C:\OpenSSL-Win32\bin\openssl.cfg
I've tried adding other systems paths like:
C:\Users\Ove\openssl\include\openssl
which is where ssl.h resides
I've also tried sticking the openssl folder in the paho\src folder locally
but I still get these errors
With this commit you can see what's happened
https://github.com/eclipse/paho.mqtt.c/commit/543e761474e4836162a0f4428323173abf2de5ad#diff-0d89939d72d5bb4940c5f129d135d9f4
Windows and MSVC don't have any kind of a system for locating library headers. So naturally, this codebase has its own system for locating the openssl headers which uses an environment variable.
openssl.cfg looks like openssl's own operational configuration, completely unrelated to building anything.
You say you tried "adding" (what does that mean?) C:\Users\Ove\openssl\include\openssl (to what?) which you say is "where ssl.h" resides. So what? Your compiler error isn't telling you it's missing ssl.h. It's telling you it's missing openssl/ssl.h. Perhaps if you "added" C:\Users\Ove\openssl\include which does contain openssl/ssl.h? But I'm not sure how it would have got there unless you copied it around, making things more confusing for yourself.
I'll tell you what I'd do:
set OpenSSLDir=C:\OpenSSL-Win32\include
Putting the openssl folder in paho\src may have worked, if by "openssl folder" you mean C:\OpenSSL-Win32\include\openssl and not C:\OpenSSL-Win32 -- if the project had done the equivalent of -I., meaning that attempts to #include <openssl/ssl.h> from paho\src\SSLSocket.c could find it at paho\src\openssl\ssl.h. However, you can see, the project hasn't done that. Therefore you could add . as an include path and probably make that solution work; or edit the code to #include "openssl/ssl.h" instead.
I've been excruciatingly verbose here because you need to understand how include paths work before you can drop libraries in on windows and combine them all. There's no magic, just simple rules.
I recently installed vs15 - preview (Stripped down version of visual studio 2015).
I am able to compile C/C++ sources from inside the IDE, but I am not able to compile with the command line interface cl.exe. It can't find the c stdlib headers. I tried to use vcvars32.bat to set the proper reg values but seemingly it cant find the "Common Tools Folder".
"ERROR: Cannot determine the location of the VS Common Tools folder."
The script uses the env. variable "%VS150COMNTOOLS%".
If I try to run "cd %VS150COMNTOOLS%" from the cmd line, it can't find the path, so this seems to be the main problem.
How can manually set %VS150COMNTOOLS% to the right path? how can I set the cmd linker settings manually (Without telling the cl.exe every time I call it)?
Okay, I solved it by adding the path to the include directories and lib directories to the env. variables as "INCLUDE", "LIB". It works now, whyever the script was not able to set those values properly. I am not fluent in reading .bat let away writing in, I assume the directory structure, which is different for the vs15 preview when compared to the full version, had not been adapted yet.
I am trying to statically build Qt using Visual Studio 2013
To do so, I'm following the instructions provided by the official website
1) ActivePerl 5.20 is downloaded, installed and added to the PATH.
2) The archive for qt-everywhere-enterprise-src-5.3.1 is downloaded and unzipped in C:\Qt\Entreprise_2
3) I open msvc 2013 command prompt, and change directory to: C:\Qt\Entreprise_2\qt-everywhere-enterprise-src-5.3.1
4) From here, I add 2 new elements to the path:
SET PATH=C:\Qt\Entreprise_2\qt-everywhere-enterprise-src-5.3.1\qtbase\bin;C:\Qt\Entreprise_2\qt-everywhere-enterprise-src-5.3.1\gnuwin32\bin;%PATH%
5) I define the QMAKESPEC in order to use msvc: SET QMAKESPEC=win32-msvc2013.
6) finally, I launch the compilation:
configure -commercial -nomake tests -nomake examples -debug -static
If I skip part 5), I instead receive the
I receive the answer:
"QMAKESPEC environment variable is set to "win32-msvc2013" which is not a supported platform"
If I skip step 6, I obtain instead:
"Unable to detect the platform from environment. Use -platform commandlineargument or set the QMAKESPEC environment variable and run configure again"
However, according to Qt support center:
1) "win32-msvc2013" is the correct QMAKESPEC to use with Visual Studio
2) If we use Visual Studio Command prompt (as I did) instead of the normal one, setting QMAKESPEC is optionnal anywey, as visual studio is supposed to set the correct parameters at the beginning
So, does anyone have any idea about how I could resolve these errors?
Incidentally does anyone knows what defines a Qmakespec as corresponding to a "supported platform"?
Had the same problem, first go look in the mkspecs folder (from the archive) and make sure your platform is there, might not be supported or look here:
http://doc.qt.io/QtSupportedPlatforms/index.html
If your platform is supported and you have it in your extracted mkspecs folder, then no clue what your problem is?!?
Apparently, a good part of the files inside the mkspec folder either failed to copy when I extracted the archive, or were destroyed afterward. Most likely the latter, as it would appears that every time I try to launch a compilation some source file are erased.
The solution I found is to recreate the source file from the archive before every compilation.