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

Build on old systems (e.g., Ubuntu 12.04) #24

Open
ducss2015 opened this issue Jul 5, 2015 · 1 comment
Open

Build on old systems (e.g., Ubuntu 12.04) #24

ducss2015 opened this issue Jul 5, 2015 · 1 comment

Comments

@ducss2015
Copy link

I use an old system with cmake 2.8.7 (not support TARGET_OBJECTS) and gcc 4.6.3 (not support -std=c++11) so the build does not work. The following patch helps me build successfully.

Hope that helps.

diff --git a/C++/CMakeLists.txt b/C++/CMakeLists.txt
index 36121c5..d05f845 100644
--- a/C++/CMakeLists.txt
+++ b/C++/CMakeLists.txt
@@ -1,6 +1,6 @@
 cmake_minimum_required(VERSION 2.8)

-SET(CMAKE_CXX_FLAGS "-std=c++11") # -DVERBOSE")
+SET(CMAKE_CXX_FLAGS "-std=c++0x") # -DVERBOSE")

 ADD_DEFINITIONS("-DMIXED")

diff --git a/C/CMakeLists.txt b/C/CMakeLists.txt
index 881c5c2..7d7b17d 100644
--- a/C/CMakeLists.txt
+++ b/C/CMakeLists.txt
@@ -7,10 +7,12 @@ SET(libsocket_src

 IF ( NOT IS_SUNOS )
     ADD_DEFINITIONS(-fPIC) # for the static library which needs to be linked into the shared libsocket++.so object.
-    ADD_LIBRARY(socket_o OBJECT ${libsocket_src})
+    #ADD_LIBRARY(socket_o OBJECT ${libsocket_src})

-    ADD_LIBRARY(socket MODULE $<TARGET_OBJECTS:socket_o>)
-    ADD_LIBRARY(socket_int STATIC $<TARGET_OBJECTS:socket_o>)
+    #ADD_LIBRARY(socket MODULE $<TARGET_OBJECTS:socket_o>)
+    #ADD_LIBRARY(socket_int STATIC $<TARGET_OBJECTS:socket_o>)
+    ADD_LIBRARY(socket MODULE ${libsocket_src})
+    ADD_LIBRARY(socket_int STATIC ${libsocket_src})

     INSTALL(TARGETS socket DESTINATION ${LIB_DIR})
 ELSE() # On SunOS (e.g. OpenIndiana) we have to link against the system's libsocket. The library is renamed to libsocket_hl (hl = high-level)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5233618..0def475 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -22,7 +22,7 @@ CONFIGURE_FILE(headers/conf.h.in ${CMAKE_SOURCE_DIR}/headers/conf.h)

 # Compiler configuration
 INCLUDE_DIRECTORIES(BEFORE ${CMAKE_SOURCE_DIR}/headers/)
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
 ADD_DEFINITIONS(-Wall -Wextra)
 #ADD_DEFINITIONS(-DVERBOSE)
@dermesser
Copy link
Owner

Thanks for the patch! However, the documentation makes it clear that a compiler supporting C++11 (i.e. not C++0x) and CMake >= 2.8.8 are required.

Adding the patch as a separate file and referencing it from the README as an easy way to gain compatibility for older systems would be very nice, though!

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