Minor review for CMake

This commit is contained in:
Chuck Walbourn 2021-01-14 00:27:35 -08:00
parent a67dccf66b
commit 2513d1afb0

View File

@ -160,7 +160,7 @@ install(
DESTINATION cmake/)
#--- Command-line tool
if(BUILD_TOOLS AND WIN32)
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
find_package(directxmesh CONFIG REQUIRED COMPONENTS library utils)
find_package(directxtex CONFIG REQUIRED)
@ -173,18 +173,18 @@ if(BUILD_TOOLS AND WIN32)
source_group(UVAtlasTool REGULAR_EXPRESSION UVAtlasTool/*.*)
target_link_libraries(uvatlastool ${PROJECT_NAME} Microsoft::DirectXMesh Microsoft::DirectXTex Microsoft::DirectXMesh::Utilities version.lib)
target_link_libraries(uvatlastool ${PROJECT_NAME} Microsoft::DirectXMesh Microsoft::DirectXTex Microsoft::DirectXMesh::Utilities ole32.lib version.lib)
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(uvatlastool 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(uvatlastool PRIVATE /arch:SSE2)
endif()
endif()
@ -194,7 +194,7 @@ 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-exit-time-destructors" "-Wno-switch" "-Wno-switch-enum" "-Wno-language-extension-token" "-Wno-missing-prototypes")
target_compile_options(uvatlastool PRIVATE ${WarningsEXE})
endif()
@ -203,13 +203,13 @@ 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(uvatlastool PRIVATE /permissive- /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(uvatlastool PRIVATE /analyze)
endif()
endif()
@ -217,7 +217,7 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
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(uvatlastool PRIVATE /Zc:preprocessor /wd5105)
endif()
endif()
@ -225,13 +225,13 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
if(UVATLAS_USE_OPENMP)
target_compile_options(${PROJECT_NAME} PRIVATE /openmp /Zc:twoPhase-)
if(BUILD_TOOLS AND WIN32)
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
target_compile_options(uvatlastool PRIVATE /openmp /Zc:twoPhase-)
endif()
endif()
if(BUILD_TOOLS AND WIN32)
set(WarningsEXE "/wd4365" "/wd4668" "/wd4710" "/wd4820" "/wd5039" "/wd5045" "/wd4061" "/wd4062" "/wd5219")
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
set(WarningsEXE "/wd4365" "/wd4514" "/wd4625" "/wd4626" "/wd4627" "/wd4668" "/wd4710" "/wd4751" "/wd4820" "/wd5026" "/wd5027" "/wd5039" "/wd5045" "/wd4061" "/wd4062" "/wd5219")
target_compile_options(uvatlastool PRIVATE ${WarningsEXE})
endif()
endif()
@ -245,12 +245,12 @@ if(MSVC)
target_compile_definitions(${PROJECT_NAME} PRIVATE _WIN32_WINNT=0x0601)
endif()
if(BUILD_TOOLS AND WIN32)
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
target_compile_definitions(uvatlastool PRIVATE _UNICODE UNICODE _WIN32_WINNT=0x0601)
endif()
endif()
if(BUILD_TOOLS AND WIN32)
if(BUILD_TOOLS AND WIN32 AND (NOT WINDOWS_STORE))
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT uvatlastool)
else()
set_property(DIRECTORY PROPERTY VS_STARTUP_PROJECT ${PROJECT_NAME})