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

CXX Standard #174

Open
kheaactua opened this issue Jan 28, 2022 · 2 comments
Open

CXX Standard #174

kheaactua opened this issue Jan 28, 2022 · 2 comments

Comments

@kheaactua
Copy link

Without altering the C++ Standard in the CMake file, I kept running into errors like:

duma/src/dumapp.cpp:198:18: error: declaration of 'void* operator new(size_t, const std::nothrow_t&) throw ()' has a different exception specifier                                                                 
 void *DUMA_CDECL operator new(DUMA_SIZE_T size,                                                                                                                                                                                              
                  ^~~~~~~~                                                                                                                                                                                                                    
In file included from local/duma/src/dumapp.cpp:38:                                                                                                                                                                      
/duma/dumapp.h:94:18: note: from previous declaration 'void* operator new(size_t, const std::nothrow_t&)'                                                                                                           
 void *DUMA_CDECL operator new(DUMA_SIZE_T, const std::nothrow_t &) throw(); 

In addition, to build on QNX, I also had to tweak how threads were linked against:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 18d9eec..f3b4499 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,8 +3,10 @@ project(DUMA C CXX)
 
 # See README.md for help building and using DUMA
 
-set(CMAKE_CXX_STANDARD 98)
-set(CMAKE_CXX_STANDARD_REQUIRED off)
+find_package(Threads)
+
+set(CMAKE_CXX_STANDARD 11)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
 
 if(POLICY CMP0063)
   cmake_policy(SET CMP0063 NEW)
@@ -190,7 +192,7 @@ endif()
 if (NOT DUMA_WITH_THREAD_SAFETY)
   target_compile_definitions(DUMA_STATIC PRIVATE DUMA_NO_THREAD_SAFETY)
 else()
-  target_link_libraries(DUMA_STATIC PUBLIC pthread)
+  target_link_libraries(DUMA_STATIC PUBLIC $<$<NOT:$<PLATFORM_ID:QNX>>:Threads::Threads>)
 endif()
 if (NOT DUMA_WITH_STRERROR)
   target_compile_definitions(DUMA_STATIC PRIVATE DUMA_NO_STRERROR)
@@ -236,7 +238,7 @@ if (WIN32 AND MINGW)
   message(STATUS "MINGW")
 else()
   message(STATUS "target link pthread to DUMA_SHARED")
-  target_link_libraries( DUMA_SHARED PUBLIC pthread )
+  target_link_libraries( DUMA_SHARED PUBLIC $<$<NOT:$<PLATFORM_ID:QNX>>:Threads::Threads> )
 endif()
@johnsonjh
Copy link
Owner

Thanks for the report (and building on QNX).

I'll try to take a look at this over the weekend.

@kheaactua
Copy link
Author

Thanks. I have it set up to work on QNX now, I have it working on small test apps, but I'm stuck on the word alignment issue for a bigger lib.

Anyways, I'm happy to help of I can in any way.

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

2 participants