[575013] Fix problems when compiling in macos Add cmake settings to enable specific solutions for some cases, applicable to all archs Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=575013 Signed-off-by: Jose Cabral <cabralcochi@gmail.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt index dad976d..66c56b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt
@@ -18,6 +18,15 @@ PROJECT(FORTE) +set(FORTE_USE_STD_11 OFF CACHE BOOL "Enable c++11 for the project") +mark_as_advanced(FORTE_USE_STD_11) + +if (FORTE_USE_STD_11) + set(CMAKE_CXX_STANDARD 11) + set(CMAKE_CXX_STANDARD_REQUIRED ON) +endif() + + if(NOT (${CMAKE_HOST_SYSTEM_NAME} STREQUAL ${CMAKE_SYSTEM_NAME})) MESSAGE("Cross compiling") SET(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1) @@ -34,7 +43,12 @@ INCLUDE(${FORTE_BUILDSUPPORT_DIRECTORY}/forte.cmake) INCLUDE(${FORTE_BUILDSUPPORT_DIRECTORY}/check_compiler_features.cmake) -TEST_NEEDED_FORTE_COMPILER_FEATURES() #Checl for compiler features and either apply fixes or error messages if not supported +set(FORTE_TEST_NEEDED_COMPILER_FEATURES ON CACHE BOOL "Check for compiler features and either apply fixes or error messages if not supported") +mark_as_advanced(FORTE_BUILD_EXECUTABLE) + +if (FORTE_TEST_NEEDED_COMPILER_FEATURES) + TEST_NEEDED_FORTE_COMPILER_FEATURES() +endif() forte_add_definition("-DFORTE_COMPILATION") #Allow to tell external modules/middleware that forte is being compiled, so special defines can be added
diff --git a/src/arch/macos/CMakeLists.txt b/src/arch/macos/CMakeLists.txt index be90412..6f3641d 100644 --- a/src/arch/macos/CMakeLists.txt +++ b/src/arch/macos/CMakeLists.txt
@@ -25,7 +25,7 @@ forte_add_sourcefile_hcpp(../posix/forte_thread forte_sync forte_sem) forte_add_sourcefile_cpp(../genforte_printer.cpp) forte_add_sourcefile_h(../forte_architecture_time.h) - forte_add_sourcefile_cpp(../genforte_realFunctions.cpp ../posix/forte_architecture_time.cpp) + forte_add_sourcefile_cpp(../genforte_realFunctions.cpp ../posix/forte_architecture_time.cpp ../utils/timespec_utils.cpp) forte_add_to_executable_cpp(../posix/main)
diff --git a/src/arch/macos/forte_sem.cpp b/src/arch/macos/forte_sem.cpp index 1ee913d..3e3a199 100644 --- a/src/arch/macos/forte_sem.cpp +++ b/src/arch/macos/forte_sem.cpp
@@ -50,7 +50,7 @@ bool CPThreadSemaphore::timedWait(const TForteUInt64 paRelativeTimeout){ struct timespec now = { 0, 0 }; clock_gettime(CLOCK_MONOTONIC, &now); - dispatch_time_t timeout = dispatch_walltime(&now, paRelativeTimeout) + dispatch_time_t timeout = dispatch_walltime(&now, paRelativeTimeout); return (0 == dispatch_semaphore_wait(mSemaphore, timeout)); }