Skip to content

Commit

Permalink
Add UTF-8 resource manifest to app and samples
Browse files Browse the repository at this point in the history
  • Loading branch information
kmilos committed Apr 12, 2024
1 parent bd0fd79 commit 66cf8a9
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 5 deletions.
10 changes: 6 additions & 4 deletions app/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
if(WIN32)
set(UTF8_RESOURCE_OBJECT utf8.rc)
endif(WIN32)

set(APP_SOURCES
exiv2.cpp
exiv2app.hpp
actions.cpp
actions.hpp
getopt.cpp
getopt.hpp
app_utils.cpp
app_utils.hpp
${UTF8_RESOURCE_OBJECT}
)

add_executable(exiv2 ${APP_SOURCES})
Expand All @@ -16,6 +17,7 @@ target_include_directories(exiv2 PRIVATE ${PROJECT_SOURCE_DIR}/src) # To find i1
set_target_properties(exiv2 PROPERTIES COMPILE_FLAGS ${EXTRA_COMPILE_FLAGS} XCODE_ATTRIBUTE_GCC_GENERATE_DEBUGGING_SYMBOLS[variant=Debug] "YES")
if(MSVC)
set_target_properties(exiv2 PROPERTIES LINK_FLAGS "/ignore:4099") # Ignore missing PDBs
target_link_options(exiv2 PRIVATE /MANIFEST:NO) # Avoid linker fatal error CVT1100: duplicate resource
endif()

target_link_libraries(exiv2 PRIVATE exiv2lib)
Expand Down
8 changes: 8 additions & 0 deletions app/utf8.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<application>
<windowsSettings>
<activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage>
</windowsSettings>
</application>
</assembly>
3 changes: 3 additions & 0 deletions app/utf8.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include <winuser.rh>

CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "utf8.manifest"
9 changes: 8 additions & 1 deletion samples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,15 @@ set(SAMPLES
xmpdump.cpp
)

if(WIN32)
set(UTF8_RESOURCE_OBJECT ${PROJECT_SOURCE_DIR}/app/utf8.rc)
endif(WIN32)

#
# build samples AND add them to the APPLICATIONS list
foreach(entry ${SAMPLES})
string(REPLACE ".cpp" "" target ${entry})
add_executable(${target} ${target}.cpp)
add_executable(${target} ${target}.cpp ${UTF8_RESOURCE_OBJECT})
set_target_properties(${target} PROPERTIES COMPILE_FLAGS ${EXTRA_COMPILE_FLAGS})
list(APPEND APPLICATIONS ${target})
target_include_directories(${target} PRIVATE ${PROJECT_SOURCE_DIR}/src) # To find enforce.hpp
Expand Down Expand Up @@ -116,6 +120,9 @@ foreach(application ${APPLICATIONS})
set_target_properties(${application} PROPERTIES LINK_FLAGS "/ignore:4099") # Ignore missing PDBs
endif()
endif()
if(MSVC)
target_link_options(${application} PRIVATE /MANIFEST:NO) # Avoid linker fatal error CVT1100: duplicate resource
endif()
endforeach()

# That's all Folks!
Expand Down

0 comments on commit 66cf8a9

Please sign in to comment.