|
|
|
@ -13,68 +13,62 @@ IF(CMAKE_COMPILER_IS_GNUCC)
|
|
|
|
|
#ENDIF()
|
|
|
|
|
|
|
|
|
|
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
|
|
|
|
|
SET(HAVE_HASH_MAP 0)
|
|
|
|
|
SET(HASH_MAP_CLASS unordered_map)
|
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
|
SET(HAVE_HASH_MAP 0)
|
|
|
|
|
SET(HASH_MAP_CLASS unordered_map)
|
|
|
|
|
|
|
|
|
|
#Check for all of the possible combinations of unordered_map and hash_map
|
|
|
|
|
#Check for all of the possible combinations of unordered_map and hash_map
|
|
|
|
|
|
|
|
|
|
FOREACH(header tr1/unordered_map unordered_map)
|
|
|
|
|
FOREACH(namespace std::tr1 std )
|
|
|
|
|
IF(HAVE_HASH_MAP EQUAL 0 AND NOT STL_HASH_OLD_GCC)
|
|
|
|
|
FOREACH(header tr1/unordered_map unordered_map)
|
|
|
|
|
FOREACH(namespace std::tr1 std )
|
|
|
|
|
IF(HAVE_HASH_MAP EQUAL 0 AND NOT STL_HASH_OLD_GCC)
|
|
|
|
|
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/testHashMap.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/testHashMap.cpp")
|
|
|
|
|
IF(CMAKE_CROSSCOMPILING)
|
|
|
|
|
TRY_COMPILE(HASH_MAP_COMPILE_RESULT ${PROJECT_BINARY_DIR}/CMakeTmp "${CMAKE_CURRENT_BINARY_DIR}/testHashMap.cpp")
|
|
|
|
|
SET(HASH_MAP_RUN_RESULT ${HASH_MAP_COMPILE_RESULT})
|
|
|
|
|
ELSE()
|
|
|
|
|
TRY_RUN(HASH_MAP_RUN_RESULT HASH_MAP_COMPILE_RESULT ${PROJECT_BINARY_DIR}/CMakeTmp "${CMAKE_CURRENT_BINARY_DIR}/testHashMap.cpp")
|
|
|
|
|
ENDIF()
|
|
|
|
|
IF (HASH_MAP_COMPILE_RESULT AND HASH_MAP_RUN_RESULT EQUAL 1)
|
|
|
|
|
SET(HASH_MAP_H <${header}>)
|
|
|
|
|
STRING(REPLACE "map" "set" HASH_SET_H ${HASH_MAP_H})
|
|
|
|
|
SET(HASH_NAMESPACE ${namespace})
|
|
|
|
|
SET(HASH_MAP_CLASS unordered_map)
|
|
|
|
|
SET(HASH_SET_CLASS unordered_set)
|
|
|
|
|
SET(HAVE_HASH_MAP 1)
|
|
|
|
|
SET(HAVE_HASH_SET 1)
|
|
|
|
|
ENDIF()
|
|
|
|
|
ENDIF()
|
|
|
|
|
ENDFOREACH(namespace)
|
|
|
|
|
ENDFOREACH(header)
|
|
|
|
|
IF (HAVE_HASH_MAP EQUAL 0)
|
|
|
|
|
SET(HASH_MAP_CLASS hash_map)
|
|
|
|
|
FOREACH(header ext/hash_map hash_map)
|
|
|
|
|
FOREACH(namespace __gnu_cxx "" std stdext)
|
|
|
|
|
IF (HAVE_HASH_MAP EQUAL 0)
|
|
|
|
|
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/testHashMap.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/testHashMap.cpp")
|
|
|
|
|
IF(CMAKE_CROSSCOMPILING)
|
|
|
|
|
TRY_COMPILE(HASH_MAP_COMPILE_RESULT ${PROJECT_BINARY_DIR}/CMakeTmp "${CMAKE_CURRENT_BINARY_DIR}/testHashMap.cpp")
|
|
|
|
|
SET(HASH_MAP_RUN_RESULT ${HASH_MAP_COMPILE_RESULT})
|
|
|
|
|
ELSE()
|
|
|
|
|
TRY_RUN(HASH_MAP_RUN_RESULT HASH_MAP_COMPILE_RESULT ${PROJECT_BINARY_DIR}/CMakeTmp "${CMAKE_CURRENT_BINARY_DIR}/testHashMap.cpp")
|
|
|
|
|
ENDIF()
|
|
|
|
|
IF (HASH_MAP_COMPILE_RESULT AND HASH_MAP_RUN_RESULT EQUAL 1)
|
|
|
|
|
TRY_COMPILE(HASH_MAP_COMPILE_RESULT ${PROJECT_BINARY_DIR}/CMakeTmp "${CMAKE_CURRENT_BINARY_DIR}/testHashMap.cpp")
|
|
|
|
|
IF (HASH_MAP_COMPILE_RESULT)
|
|
|
|
|
SET(HASH_MAP_H <${header}>)
|
|
|
|
|
STRING(REPLACE "map" "set" HASH_SET_H ${HASH_MAP_H})
|
|
|
|
|
SET(HASH_NAMESPACE ${namespace})
|
|
|
|
|
SET(HASH_MAP_CLASS unordered_map)
|
|
|
|
|
SET(HASH_SET_CLASS unordered_set)
|
|
|
|
|
SET(HASH_MAP_CLASS hash_map)
|
|
|
|
|
SET(HASH_SET_CLASS hash_set)
|
|
|
|
|
SET(HAVE_HASH_MAP 1)
|
|
|
|
|
SET(HAVE_HASH_SET 1)
|
|
|
|
|
ENDIF()
|
|
|
|
|
ENDIF()
|
|
|
|
|
ENDFOREACH(namespace)
|
|
|
|
|
ENDFOREACH(header)
|
|
|
|
|
IF (HAVE_HASH_MAP EQUAL 0)
|
|
|
|
|
SET(HASH_MAP_CLASS hash_map)
|
|
|
|
|
FOREACH(header ext/hash_map hash_map)
|
|
|
|
|
FOREACH(namespace __gnu_cxx "" std stdext)
|
|
|
|
|
IF (HAVE_HASH_MAP EQUAL 0)
|
|
|
|
|
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/testHashMap.cpp.in" "${CMAKE_CURRENT_BINARY_DIR}/testHashMap.cpp")
|
|
|
|
|
TRY_COMPILE(HASH_MAP_COMPILE_RESULT ${PROJECT_BINARY_DIR}/CMakeTmp "${CMAKE_CURRENT_BINARY_DIR}/testHashMap.cpp")
|
|
|
|
|
IF (HASH_MAP_COMPILE_RESULT)
|
|
|
|
|
SET(HASH_MAP_H <${header}>)
|
|
|
|
|
STRING(REPLACE "map" "set" HASH_SET_H ${HASH_MAP_H})
|
|
|
|
|
SET(HASH_NAMESPACE ${namespace})
|
|
|
|
|
SET(HASH_MAP_CLASS hash_map)
|
|
|
|
|
SET(HASH_SET_CLASS hash_set)
|
|
|
|
|
SET(HAVE_HASH_MAP 1)
|
|
|
|
|
SET(HAVE_HASH_SET 1)
|
|
|
|
|
ENDIF()
|
|
|
|
|
ENDIF()
|
|
|
|
|
ENDFOREACH()
|
|
|
|
|
ENDFOREACH()
|
|
|
|
|
ENDIF()
|
|
|
|
|
ENDFOREACH()
|
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
|
IF (HAVE_HASH_MAP EQUAL 0)
|
|
|
|
|
MESSAGE(SEND_ERROR "Could not find a working hash map implementation. Please install GCC >= 4.4, and all necessary 32-bit C++ development libraries.")
|
|
|
|
|
ENDIF()
|
|
|
|
|
IF (HAVE_HASH_MAP EQUAL 0)
|
|
|
|
|
MESSAGE(SEND_ERROR "Could not find a working hash map implementation. Please install GCC >= 4.4, and all necessary 32-bit C++ development libraries.")
|
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
|
IF(UNIX)
|
|
|
|
|
FIND_PACKAGE(Threads)
|
|
|
|
|
|
|
|
|
|
ELSE()
|
|
|
|
|
SET(HASH_MAP_H <hash_map>)
|
|
|
|
|
SET(HASH_NAMESPACE std)
|
|
|
|
|
SET(HASH_SET_H <hash_set>)
|
|
|
|
|
SET(HAVE_HASH_MAP 1)
|
|
|
|
|
SET(HAVE_HASH_SET 1)
|
|
|
|
|
SET(HASH_MAP_CLASS hash_map)
|
|
|
|
|
SET(HASH_SET_CLASS hash_set)
|
|
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
|
|
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/config.h.in" "${CMAKE_CURRENT_BINARY_DIR}/config.h")
|
|
|
|
@ -250,4 +244,4 @@ IF(NOT CMAKE_CROSSCOMPILING)
|
|
|
|
|
TARGET_LINK_LIBRARIES(protoc-bin protoc)
|
|
|
|
|
|
|
|
|
|
EXPORT(TARGETS protoc-bin FILE ${CMAKE_BINARY_DIR}/ImportExecutables.cmake )
|
|
|
|
|
ENDIF()
|
|
|
|
|
ENDIF()
|