forked from jasder/antlr
Merge pull request #2064 from antlr/revert-2011-master
Revert "CMake build fixes for Visual Studio"
This commit is contained in:
commit
eacbe23ea1
|
@ -25,8 +25,7 @@ project(LIBANTLR4)
|
||||||
|
|
||||||
if(CMAKE_VERSION VERSION_EQUAL "3.0.0" OR
|
if(CMAKE_VERSION VERSION_EQUAL "3.0.0" OR
|
||||||
CMAKE_VERSION VERSION_GREATER "3.0.0")
|
CMAKE_VERSION VERSION_GREATER "3.0.0")
|
||||||
CMAKE_POLICY(SET CMP0026 NEW)
|
CMAKE_POLICY(SET CMP0026 OLD)
|
||||||
CMAKE_POLICY(SET CMP0054 OLD)
|
|
||||||
CMAKE_POLICY(SET CMP0045 OLD)
|
CMAKE_POLICY(SET CMP0045 OLD)
|
||||||
CMAKE_POLICY(SET CMP0042 OLD)
|
CMAKE_POLICY(SET CMP0042 OLD)
|
||||||
endif()
|
endif()
|
||||||
|
@ -63,9 +62,7 @@ if (WITH_DEMO)
|
||||||
endif()
|
endif()
|
||||||
endif(WITH_DEMO)
|
endif(WITH_DEMO)
|
||||||
|
|
||||||
if (NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
set(MY_CXX_WARNING_FLAGS " -Wall -pedantic -W")
|
||||||
set(MY_CXX_WARNING_FLAGS " -Wall -pedantic -W")
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
# Initialize CXXFLAGS.
|
# Initialize CXXFLAGS.
|
||||||
if("${CMAKE_VERSION}" VERSION_GREATER 3.1.0)
|
if("${CMAKE_VERSION}" VERSION_GREATER 3.1.0)
|
||||||
|
@ -79,13 +76,11 @@ else()
|
||||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -std=c++11")
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -std=c++11")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall ${MY_CXX_WARNING_FLAGS}")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall ${MY_CXX_WARNING_FLAGS}")
|
||||||
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g ${MY_CXX_WARNING_FLAGS}")
|
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g ${MY_CXX_WARNING_FLAGS}")
|
||||||
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -Os -DNDEBUG ${MY_CXX_WARNING_FLAGS}")
|
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -Os -DNDEBUG ${MY_CXX_WARNING_FLAGS}")
|
||||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -DNDEBUG ${MY_CXX_WARNING_FLGAS}")
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -DNDEBUG ${MY_CXX_WARNING_FLGAS}")
|
||||||
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O2 -g ${MY_CXX_WARNING_FLAGS}")
|
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O2 -g ${MY_CXX_WARNING_FLAGS}")
|
||||||
endif ()
|
|
||||||
|
|
||||||
# Compiler-specific C++11 activation.
|
# Compiler-specific C++11 activation.
|
||||||
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
|
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
|
||||||
|
@ -107,7 +102,6 @@ elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang" AND CMAKE_SYSTEM_NAME MATCHES
|
||||||
if (WITH_LIBCXX)
|
if (WITH_LIBCXX)
|
||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
|
||||||
endif()
|
endif()
|
||||||
elseif (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
|
||||||
else ()
|
else ()
|
||||||
message(FATAL_ERROR "Your C++ compiler does not support C++11.")
|
message(FATAL_ERROR "Your C++ compiler does not support C++11.")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
|
@ -206,13 +206,11 @@ macro(antlr4cpp_process_grammar
|
||||||
# export generated cpp files into list
|
# export generated cpp files into list
|
||||||
foreach(generated_file ${generated_files})
|
foreach(generated_file ${generated_files})
|
||||||
list(APPEND antlr4cpp_src_files_${antlr4cpp_project_namespace} ${generated_file})
|
list(APPEND antlr4cpp_src_files_${antlr4cpp_project_namespace} ${generated_file})
|
||||||
if (NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
|
||||||
set_source_files_properties(
|
set_source_files_properties(
|
||||||
${generated_file}
|
${generated_file}
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
COMPILE_FLAGS -Wno-overloaded-virtual
|
COMPILE_FLAGS -Wno-overloaded-virtual
|
||||||
)
|
)
|
||||||
endif ()
|
|
||||||
endforeach(generated_file)
|
endforeach(generated_file)
|
||||||
message(STATUS "Antlr4Cpp ${antlr4cpp_project_namespace} Generated: ${generated_files}")
|
message(STATUS "Antlr4Cpp ${antlr4cpp_project_namespace} Generated: ${generated_files}")
|
||||||
|
|
||||||
|
|
|
@ -45,17 +45,11 @@ set(antlr4-demo_SRC
|
||||||
${antlr4-demo-GENERATED_SRC}
|
${antlr4-demo-GENERATED_SRC}
|
||||||
)
|
)
|
||||||
|
|
||||||
if (NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
|
||||||
set (flags_1 "-Wno-overloaded-virtual")
|
|
||||||
else()
|
|
||||||
set (flags_1 "-MP /wd4251")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
foreach( src_file ${antlr4-demo_SRC} )
|
foreach( src_file ${antlr4-demo_SRC} )
|
||||||
set_source_files_properties(
|
set_source_files_properties(
|
||||||
${src_file}
|
${src_file}
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
COMPILE_FLAGS "${COMPILE_FLAGS} ${flags_1}"
|
COMPILE_FLAGS -Wno-overloaded-virtual
|
||||||
)
|
)
|
||||||
endforeach( src_file ${antlr4-demo_SRC} )
|
endforeach( src_file ${antlr4-demo_SRC} )
|
||||||
|
|
||||||
|
|
|
@ -44,10 +44,7 @@ elseif(APPLE)
|
||||||
target_link_libraries(antlr4_static ${COREFOUNDATION_LIBRARY})
|
target_link_libraries(antlr4_static ${COREFOUNDATION_LIBRARY})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
set(disabled_compile_warnings "-Wno-overloaded-virtual")
|
||||||
set(disabled_compile_warnings "-Wno-overloaded-virtual")
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
|
||||||
set(disabled_compile_warnings "${disabled_compile_warnings} -Wno-dollar-in-identifier-extension -Wno-four-char-constants")
|
set(disabled_compile_warnings "${disabled_compile_warnings} -Wno-dollar-in-identifier-extension -Wno-four-char-constants")
|
||||||
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
|
elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
|
||||||
|
@ -61,11 +58,6 @@ if (WIN32)
|
||||||
set(extra_static_compile_flags "-DANTLR4CPP_STATIC")
|
set(extra_static_compile_flags "-DANTLR4CPP_STATIC")
|
||||||
endif(WIN32)
|
endif(WIN32)
|
||||||
|
|
||||||
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
|
|
||||||
set(extra_share_compile_flags "-DANTLR4CPP_EXPORTS -MP /wd4251")
|
|
||||||
set(extra_static_compile_flags "-DANTLR4CPP_STATIC -MP")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set_target_properties(antlr4_shared
|
set_target_properties(antlr4_shared
|
||||||
PROPERTIES VERSION ${ANTLR_VERSION}
|
PROPERTIES VERSION ${ANTLR_VERSION}
|
||||||
SOVERSION ${ANTLR_VERSION}
|
SOVERSION ${ANTLR_VERSION}
|
||||||
|
|
Loading…
Reference in New Issue