Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compile Issue with OS Defines in VS Code #1481

Open
nicofer00 opened this issue May 7, 2024 · 4 comments
Open

Compile Issue with OS Defines in VS Code #1481

nicofer00 opened this issue May 7, 2024 · 4 comments
Labels

Comments

@nicofer00
Copy link

#if !defined(_WINDOWS)

At first, trying to build on Windows 10 machine with OpenSSL variables passed in. Testing is enabled by default but would cause the build to fail at compile time. Probably should also check for _WIN32 because I don't think _WINDOWS was being defined. When I added it in manually to the CMakeLists.txt then it could successfully compile. I also tried alternatively adding checks to the test files to guard windows compilation better.

image

I made changes to make the statements #if !defined(_WINDOWS) && !defined(_WIN32) && !defined(_WIN64) and #if defined(_WINDOWS) || defined(_WIN32) || defined(_WIN64) which successfully compiled and ran the tests for me.

Current work around is to skip it in my compilation with the command:
cmake -G "Unix Makefiles" -B build -DCMAKE_INSTALL_PREFIX=/ -DPAHO_BUILD_STATIC=TRUE -DPAHO_ENABLE_TESTING=FALSE -DPAHO_WITH_SSL=TRUE -DOPENSSL_ROOT_DIR="C:\Program Files\OpenSSL-Win64\"

then:
cmake --build build/ --target install

which worked as well.

@nicofer00
Copy link
Author

paho_issue_1481.txt

here is a diff of changes that allowed me to successfully compile with tests enabled in windows. Probably not the best way to go about it but just to show it works...

@jumoog
Copy link
Contributor

jumoog commented May 7, 2024

I have the following Preprocessor Definitions

%(PreprocessorDefinitions);WIN32;_WINDOWS;_CRT_SECURE_NO_DEPRECATE;WIN32_LEAN_AND_MEAN;CMAKE_INTDIR="Debug"

@jumoog
Copy link
Contributor

jumoog commented May 7, 2024

@nicofer00
Copy link
Author

Ok so VS Code configuration thing, I guess! The extra compile guards could take away the need for that manual step if that's desirable in the future, but this makes sense to me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants