Skip to content

Commit

Permalink
Minor review for CMake
Browse files Browse the repository at this point in the history
  • Loading branch information
walbourn committed Jan 14, 2021
1 parent 98af91b commit 3f50a1f
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ install(FILES
DESTINATION cmake/)

#--- Command-line tool
if(BUILD_TOOLS AND WIN32)
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
add_executable(meshconvert
Meshconvert/Meshconvert.cpp
Meshconvert/MeshOBJ.cpp
Expand All @@ -155,13 +155,13 @@ if(BUILD_TOOLS AND WIN32)
endif()
if(MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE /fp:fast)
if(BUILD_TOOLS AND WIN32)
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
target_compile_options(meshconvert PRIVATE /fp:fast)
endif()

if(${CMAKE_SIZEOF_VOID_P} EQUAL "4")
if(${CMAKE_SIZEOF_VOID_P} EQUAL "4" AND (NOT ${CMAKE_VS_PLATFORM_NAME} MATCHES "arm"))
target_compile_options(${PROJECT_NAME} PRIVATE /arch:SSE2)
if(BUILD_TOOLS AND WIN32)
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
target_compile_options(meshconvert PRIVATE /arch:SSE2)
endif()
endif()
Expand All @@ -171,41 +171,41 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(WarningsLib "-Wpedantic" "-Wextra")
target_compile_options(${PROJECT_NAME} PRIVATE ${WarningsLib})

if(BUILD_TOOLS AND WIN32)
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
set(WarningsEXE ${WarningsLib} "-Wno-c++98-compat" "-Wno-c++98-compat-pedantic" "-Wno-switch" "-Wno-switch-enum" "-Wno-double-promotion" "-Wno-exit-time-destructors" "-Wno-missing-prototypes")
target_compile_options(meshconvert PRIVATE ${WarningsEXE})
endif()
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
target_compile_options(${PROJECT_NAME} PRIVATE /permissive- /JMC- /Zc:__cplusplus)
if(BUILD_TOOLS AND WIN32)
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
target_compile_options(meshconvert PRIVATE /permissive- /JMC- /Zc:__cplusplus)
endif()

if(ENABLE_CODE_ANALYSIS)
target_compile_options(${PROJECT_NAME} PRIVATE /analyze)
if(BUILD_TOOLS AND WIN32)
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
target_compile_options(meshconvert PRIVATE /analyze)
endif()
endif()

if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.26)
target_compile_options(${PROJECT_NAME} PRIVATE /Zc:preprocessor /wd5105)
if(BUILD_TOOLS AND WIN32)
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
target_compile_options(meshconvert PRIVATE /Zc:preprocessor /wd5105)
endif()
endif()

if(BUILD_TOOLS AND WIN32)
set(WarningsEXE "/wd4061" "/wd4365" "/wd4668" "/wd4710" "/wd4820" "/wd5039" "/wd5045" "/wd5219")
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
set(WarningsEXE "/wd4061" "/wd4365" "/wd4514" "/wd4625" "/wd4626" "/wd4627" "/wd4668" "/wd4710" "/wd4751" "/wd4820" "/wd5026" "/wd5027" "/wd5039" "/wd5045" "/wd5219")
target_compile_options(meshconvert PRIVATE ${WarningsEXE})
endif()
endif()

if(WIN32)
# Windows 10 is used here to build the DirectX 12 code paths as well as 11
target_compile_definitions(${PROJECT_NAME} PRIVATE _UNICODE UNICODE)
if(BUILD_TOOLS AND WIN32)
if(BUILD_TOOLS AND (NOT WINDOWS_STORE))
target_compile_definitions(meshconvert PRIVATE _UNICODE UNICODE _WIN32_WINNT=0x0601)
endif()

Expand All @@ -216,6 +216,6 @@ if(WIN32)
endif()
endif()

if(BUILD_TOOLS AND WIN32)
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT meshconvert)
endif()

0 comments on commit 3f50a1f

Please sign in to comment.