Skip to content

Commit

Permalink
CMake code review
Browse files Browse the repository at this point in the history
  • Loading branch information
walbourn committed Dec 14, 2019
1 parent 9a8cc96 commit b81d71d
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ cmake_minimum_required (VERSION 3.11)

project (UVAtlas LANGUAGES CXX)

option(BUILD_TOOLS "Build UVAtlasTool" ON)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
Expand Down Expand Up @@ -88,9 +90,7 @@ if(MSVC)
string(REPLACE "/GR " "/GR- " CMAKE_CXX_FLAGS_RELEASE ${CMAKE_CXX_FLAGS_RELEASE})
endif()

option(BUILD_TOOLS "Build UVAtlasTool" ON)

if(BUILD_TOOLS)
if(BUILD_TOOLS MATCHES ON)
if(NOT EXISTS "${CMAKE_SOURCE_DIR}/../DirectXMesh/CMakeLists.txt")
message(FATAL_ERROR "uvatalastool requires DirectXMesh library from http://go.microsoft.com/fwlink/?LinkID=324981" )
endif()
Expand All @@ -113,13 +113,13 @@ endif()

if(MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE /fp:fast)
if(BUILD_TOOLS)
if(BUILD_TOOLS MATCHES ON)
target_compile_options(uvatlastool PRIVATE /fp:fast)
endif()

if (${CMAKE_SIZEOF_VOID_P} EQUAL "4")
target_compile_options(${PROJECT_NAME} PRIVATE /arch:SSE2)
if(BUILD_TOOLS)
if(BUILD_TOOLS MATCHES ON)
target_compile_options(uvatlastool PRIVATE /arch:SSE2)
endif()
endif()
Expand All @@ -129,7 +129,7 @@ if ( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
set(WarningsLib "-Wpedantic" "-Wextra")
target_compile_options(${PROJECT_NAME} PRIVATE ${WarningsLib})

if(BUILD_TOOLS)
if(BUILD_TOOLS MATCHES ON)
set(WarningsEXE ${WarningsLib} "-Wno-c++98-compat" "-Wno-c++98-compat-pedantic" "-Wno-exit-time-destructors" "-Wno-switch" "-Wno-switch-enum" "-Wno-language-extension-token" "-Wno-missing-prototypes")
target_compile_options(uvatlastool PRIVATE ${WarningsEXE})
endif()
Expand All @@ -139,7 +139,7 @@ if ( CMAKE_CXX_COMPILER_ID MATCHES "MSVC" )
target_compile_options(${PROJECT_NAME} PRIVATE /permissive- /JMC- /Zc:__cplusplus)
target_compile_options(uvatlastool PRIVATE /permissive- /Zc:__cplusplus)

if(BUILD_TOOLS)
if(BUILD_TOOLS MATCHES ON)
set(WarningsEXE "/wd4365" "/wd4710" "/wd4820" "/wd5039" "/wd5045")
target_compile_options(uvatlastool PRIVATE ${WarningsEXE})
endif()
Expand All @@ -148,7 +148,7 @@ endif()
if(MSVC)
# We use Windows 7 here
target_compile_definitions(${PROJECT_NAME} PRIVATE _UNICODE UNICODE _WIN32_WINNT=0x0601)
if(BUILD_TOOLS)
if(BUILD_TOOLS MATCHES ON)
target_compile_definitions(uvatlastool PRIVATE _UNICODE UNICODE _WIN32_WINNT=0x0601)
endif()
endif()

0 comments on commit b81d71d

Please sign in to comment.