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

For the God, don't destroy cplusplus project. #11

Open
Ron2014 opened this issue Feb 9, 2020 · 5 comments
Open

For the God, don't destroy cplusplus project. #11

Ron2014 opened this issue Feb 9, 2020 · 5 comments

Comments

@Ron2014
Copy link

Ron2014 commented Feb 9, 2020

For the God, don't destroy cplusplus project.

My job is intergrate openssl to the c++ project of our team by cmake , and I found your repo, this repo.

Really nice repo.

But when I found the code in openssl-cmake/CMakeLists.txt:

...
if( MSVC )
  include( MSVCRuntime )
  configure_msvc_runtime()
...

MSVCRuntime.cmake this file change all the C++ compiler options, make my project don't understand c++ syntax like:

syntax error: identifier '...'

Finally, I remove these two lines and get everything well.

  include( MSVCRuntime )
  configure_msvc_runtime()

Wish you consider about it.

For detail

snapshot

my wiki

@janbar
Copy link
Owner

janbar commented Feb 9, 2020

The new commit f0d9bcb could help.
The project requires a minimal configuration for MSVC. I cannot remove completely the runtime configuration because existing projects using this repos need it. Let me know if it works for you with the commit above, or an option could be added to bypass configure_msvc_runtime.

@Ron2014
Copy link
Author

Ron2014 commented Feb 9, 2020

Good Job, Buddy.

Good news, it works. only comment these lines:

		# set(CMAKE_CXX_FLAGS "${CMAKE_C_FLAGS}")
		# set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}")
		# set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
		# set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL}")
		# set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")

@dmenendez-gruposantander

Another issue with cmake/MSVCRuntime.cmake: it replaces /Ob0 with /Ob2 globally!
Now I'm unable to properly debug my own code because you choose to change global compilation flags,
This is very very bad!

Two questions:

  1. why oh why do you change that /Ob option? even in Debug?
  2. why can't you use a more modern CMake style using target_compile_options(), so you don't mess with global compile options?

@janbar
Copy link
Owner

janbar commented Apr 26, 2022

You can fork it and make all changes you need for your project.

@dmenendez-gruposantander

You can fork it and make all changes you need for your project.

But why would you change /Ob0 to /Ob2 in Debug mode?

Also, would you accept a PR that left the /Ob0 there in Debug mode?

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

No branches or pull requests

3 participants