1
0
Fork 0

[F] Fixed build for msvc

This commit is contained in:
seleznevae 2018-04-16 21:39:29 +03:00
parent 9462681dcb
commit 72dbe85b7f
1 changed files with 12 additions and 13 deletions

View File

@ -43,16 +43,15 @@ include_directories(src)
# Warnings # Warnings
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
if(FORT_COMPILER STREQUAL "MSVC") if("${FORT_COMPILER}" STREQUAL "MSVC")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -W4") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -W4")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W4") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -W4")
else(FORT_COMPILER STREQUAL "MSVC") else("${FORT_COMPILER}" STREQUAL "MSVC")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -g -Wextra") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -g -Wextra")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -g -Wextra") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -g -Wextra")
endif(FORT_COMPILER STREQUAL "MSVC") endif("${FORT_COMPILER}" STREQUAL "MSVC")
MESSAGE( STATUS "FORT_COMPILER: " ${FORT_COMPILER} )
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
@ -116,16 +115,16 @@ endif(FORT_CXX_BUILD)
# Sanitizers # Sanitizers
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
if(FORT_COMPILER STREQUAL "GNU" OR FORT_COMPILER STREQUAL "Clang") if("${FORT_COMPILER}" STREQUAL "GNU" OR "${FORT_COMPILER}" STREQUAL "Clang")
# asan case # asan case
if(FORT_BUILD_TYPE STREQUAL "asan") if(FORT_BUILD_TYPE STREQUAL "asan")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
if(FORT_COMPILER STREQUAL "GNU") if("${FORT_COMPILER}" STREQUAL "GNU")
target_link_libraries(${PROJECT_NAME}_example asan) target_link_libraries(${PROJECT_NAME}_example asan)
target_link_libraries(${PROJECT_NAME}_test asan) target_link_libraries(${PROJECT_NAME}_test asan)
target_link_libraries(${PROJECT_NAME}_example_cpp asan) target_link_libraries(${PROJECT_NAME}_example_cpp asan)
endif(FORT_COMPILER STREQUAL "GNU") endif("${FORT_COMPILER}" STREQUAL "GNU")
endif(FORT_BUILD_TYPE STREQUAL "asan") endif(FORT_BUILD_TYPE STREQUAL "asan")
#ubsan case #ubsan case
@ -133,12 +132,12 @@ if(FORT_COMPILER STREQUAL "GNU" OR FORT_COMPILER STREQUAL "Clang")
# -fno-sanitize-recover option is used to force faild # -fno-sanitize-recover option is used to force faild
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined -fno-sanitize-recover") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined -fno-sanitize-recover")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined -fno-sanitize-recover") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined -fno-sanitize-recover")
if(FORT_COMPILER STREQUAL "GNU") if("${FORT_COMPILER}" STREQUAL "GNU")
target_link_libraries(${PROJECT_NAME}_example ubsan) target_link_libraries(${PROJECT_NAME}_example ubsan)
target_link_libraries(${PROJECT_NAME}_example_cpp ubsan) target_link_libraries(${PROJECT_NAME}_example_cpp ubsan)
target_link_libraries(${PROJECT_NAME}_test ubsan) target_link_libraries(${PROJECT_NAME}_test ubsan)
endif(FORT_COMPILER STREQUAL "GNU") endif("${FORT_COMPILER}" STREQUAL "GNU")
endif(FORT_BUILD_TYPE STREQUAL "ubsan") endif("${FORT_COMPILER}" STREQUAL "ubsan")
#coveralls case #coveralls case
if(FORT_BUILD_TYPE STREQUAL "coveralls") if(FORT_BUILD_TYPE STREQUAL "coveralls")
@ -147,14 +146,14 @@ if(FORT_COMPILER STREQUAL "GNU" OR FORT_COMPILER STREQUAL "Clang")
#target_link_libraries(${PROJECT_NAME}_example_cpp gcov) #target_link_libraries(${PROJECT_NAME}_example_cpp gcov)
endif(FORT_BUILD_TYPE STREQUAL "coveralls") endif(FORT_BUILD_TYPE STREQUAL "coveralls")
endif(FORT_COMPILER STREQUAL "GNU" OR FORT_COMPILER STREQUAL "Clang") endif("${FORT_COMPILER}" STREQUAL "GNU" OR "${FORT_COMPILER}" STREQUAL "Clang")
# Hack for some gcc versions # Hack for some gcc versions
if(FORT_COMPILER STREQUAL "GNU") if("${FORT_COMPILER}" STREQUAL "GNU")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=gold") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fuse-ld=gold")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-ld=gold")
endif(FORT_COMPILER STREQUAL "GNU") endif("${FORT_COMPILER}" STREQUAL "GNU")