-
-
Save melak47/f7d83046c6d57b338d633468d078f5b1 to your computer and use it in GitHub Desktop.
example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.15) | |
project(example CXX) | |
find_program(CMAKE_MC_COMPILER mc.exe DOC "WinSDK message compiler") | |
if(NOT CMAKE_MC_COMPILER) | |
message(FATAL_ERROR "mc.exe was not found") | |
else() | |
message(STATUS "mc.exe found at: ${CMAKE_MC_COMPILER}") | |
endif() | |
add_custom_command( | |
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/example.rc ${CMAKE_CURRENT_BINARY_DIR}/example.hpp ${CMAKE_CURRENT_BINARY_DIR}/example_MSG00001.bin | |
COMMAND ${CMAKE_MC_COMPILER} -b -e hpp -h ${CMAKE_CURRENT_BINARY_DIR} -r ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/example.mc | |
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/example.mc | |
) | |
# create a resource-only DLL | |
add_library(example MODULE ${CMAKE_CURRENT_BINARY_DIR}/example.rc) | |
set_target_properties(example PROPERTIES LINKER_LANGUAGE CXX) | |
target_link_options(example PRIVATE $<$<CXX_COMPILER_ID:MSVC>:/noentry>) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment