From ae40343c547712cadd21f69645c2d88d79802fd8 Mon Sep 17 00:00:00 2001 From: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com> Date: Fri, 25 Sep 2020 21:06:11 -0400 Subject: [PATCH] misc: remove cmake unicode/implicit conversion warnings - fix forcing unicode compilation with msc - remove implicit string to bool conversion - ignore vs/cmake generated files Change-Id: Ief81760ae1be2aa253374e4116ec96e3709ef910 --- .gitignore | 1 + CMakeLists.txt | 12 +++++++----- src/qtwrapper/CMakeLists.txt | 12 +++++++----- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index b0bb017e..b8a3225d 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,4 @@ build-qml/ msvc/ translations/*.qm +CMakeLists.txt.user diff --git a/CMakeLists.txt b/CMakeLists.txt index ba916933..b3e31012 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -245,13 +245,13 @@ ENDIF() IF(NOT (${ENABLE_VIDEO} MATCHES false)) MESSAGE(STATUS "VIDEO enabled") - SET(ENABLE_VIDEO 1 CACHE BOOLEAN "Enable video") + SET(ENABLE_VIDEO 1 CACHE BOOL "Enable video") add_definitions( -DENABLE_VIDEO=true ) ENDIF(NOT (${ENABLE_VIDEO} MATCHES false)) IF(NOT (${ENABLE_PLUGIN} MATCHES false)) MESSAGE(STATUS "PLUGIN enabled") - SET(ENABLE_PLUGIN 1 CACHE BOOLEAN "Enable plugin") + SET(ENABLE_PLUGIN 1 CACHE BOOL "Enable plugin") add_definitions( -DENABLE_PLUGIN=true ) ENDIF(NOT (${ENABLE_PLUGIN} MATCHES false)) @@ -783,6 +783,8 @@ IF((${ENABLE_TEST} MATCHES true)) ENDIF() ENDIF() -IF (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /U_MBCS /DUNICODE") -ENDIF() +if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + add_definitions(-DUNICODE -D_UNICODE) + remove_definitions(-D_MBCS) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") +endif() diff --git a/src/qtwrapper/CMakeLists.txt b/src/qtwrapper/CMakeLists.txt index b68ff4bd..3cafbbcd 100644 --- a/src/qtwrapper/CMakeLists.txt +++ b/src/qtwrapper/CMakeLists.txt @@ -31,13 +31,13 @@ SET(libqtwrapper_LIB_SRCS IF(NOT (${ENABLE_VIDEO} MATCHES "false")) MESSAGE("VIDEO enabled") ADD_DEFINITIONS(-DENABLE_VIDEO=true) - SET(ENABLE_VIDEO 1 CACHE BOOLEAN "Enable video") + SET(ENABLE_VIDEO 1 CACHE BOOL "Enable video") ENDIF(NOT (${ENABLE_VIDEO} MATCHES "false")) IF(NOT (${ENABLE_PLUGIN} MATCHES "false")) MESSAGE("PLUGIN enabled") ADD_DEFINITIONS(-DENABLE_PLUGIN=true) - SET(ENABLE_PLUGIN 1 CACHE BOOLEAN "Enable plugin") + SET(ENABLE_PLUGIN 1 CACHE BOOL "Enable plugin") ENDIF(NOT (${ENABLE_PLUGIN} MATCHES "false")) IF(ENABLE_PLUGIN) @@ -68,6 +68,8 @@ if (NOT (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")) ADD_DEFINITIONS("-std=c++0x") endif() -IF (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /U_MBCS /DUNICODE") -ENDIF() \ No newline at end of file +if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + add_definitions(-DUNICODE -D_UNICODE) + remove_definitions(-D_MBCS) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") +endif() \ No newline at end of file -- GitLab