Skip to content

Fix conditional inclusion of headers and namespace for shared_ptr#202

Merged
orenmnero merged 3 commits into
quickfix:masterfrom
whoan:fix-conditional-shared-ptr
Sep 24, 2020
Merged

Fix conditional inclusion of headers and namespace for shared_ptr#202
orenmnero merged 3 commits into
quickfix:masterfrom
whoan:fix-conditional-shared-ptr

Conversation

@whoan
Copy link
Copy Markdown
Contributor

@whoan whoan commented Jul 11, 2018

I wasn't being able to compile the project on CentOS 7.5 with cmake because of a missing condition in the src/C++/Utility.h file.

This PR fixes two things:

  • A wrong HAVE_STD_TR1_SHARED_PTR condition where it was including <tr1/memory> instead of just <memory>
  • Adds the missing HAVE_STD_TR1_SHARED_PTR_FROM_TR1_MEMORY_HEADER condition to include <tr1/memory> and use the namespace ptr = std::tr1

The solution is based on the content of the file cmake/FindSharedPtr.cmake:

This is the condition to set the HAVE_STD_TR1_SHARED_PTR variable:

check_cxx_source_compiles("#include <memory>
                           int main() {
                             std::shared_ptr<int> int_ptr;
                             return 0;
                           }"
                          HAVE_SHARED_PTR_IN_STD_NAMESPACE)

And this is the one to set HAVE_STD_TR1_SHARED_PTR_FROM_TR1_MEMORY_HEADER:

check_cxx_source_compiles("#include <tr1/memory>
                           int main() {
                             std::tr1::shared_ptr<int> int_ptr;
                             return 0;
                           }"
                          HAVE_SHARED_PTR_IN_TR1_NAMESPACE_FROM_TR1_MEMORY_HEADER)

@orenmnero orenmnero merged commit ad3c937 into quickfix:master Sep 24, 2020
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

Successfully merging this pull request may close these issues.

2 participants