Skip to content

Commit 11d22e0

Browse files
committed
Fix check for MSVC compiler
1 parent 6c3bcbf commit 11d22e0

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

CMakeLists.txt

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@ set(FLANN_VERSION 1.8.4)
1212
DISSECT_VERSION()
1313
GET_OS_INFO()
1414

15-
# CMAKE_C_COMPILER_ID and CMAKE_CXX_COMPILER_ID are documented as internal variables subject to
16-
# change at: http://www.cmake.org/cmake/help/v2.8.8/cmake.html#variable:CMAKE_LANG_COMPILER_ID
17-
# however currently this seems the most robust way to detect the presence of the Clang compiler
15+
16+
# detect if using the Clang compiler
1817
if("${CMAKE_C_COMPILER_ID}" MATCHES "Clang")
1918
set(CMAKE_COMPILER_IS_CLANG 1)
2019
endif ()
@@ -146,12 +145,12 @@ include_directories(BEFORE ${PROJECT_SOURCE_DIR}/src/cpp)
146145
# require proper c++
147146
#add_definitions( "-Wall -ansi -pedantic" )
148147
# HDF5 uses long long which is not ansi
149-
if (WIN32)
148+
if("${CMAKE_C_COMPILER_ID}" MATCHES "MSVC" OR "${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC")
150149
# lots of warnings with cl.exe right now, use /W1
151150
add_definitions("/W1 -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_WARNINGS /bigobj")
152-
else(WIN32)
151+
else()
153152
add_definitions( "-Wall -Wno-unknown-pragmas -Wno-unused-function" )
154-
endif(WIN32)
153+
endif()
155154

156155
add_subdirectory( cmake )
157156
add_subdirectory( src )

0 commit comments

Comments
 (0)