<div dir="ltr"><div>Hi R0b0t1,</div><div><br></div><div>add_definitions() is for adding preprocessor macro definitions (-D options), not for general compilation options such as -m. You should set the options as compilation options instead, using target_compile_options. Also, -mwindows should probably not be passed directly; instead, use CMake's built-in WIN32 argument in add_executable. Overall, it would look like this:<br></div><div><br></div><div>
include_directories (<br>
  "${CMAKE_CURRENT_SOURCE_DIR}"<br>
)<br><br>
add_executable (<br>
  mtktool</div><div>  WIN32<br></div><div>  mtktool.c<br>
)</div><div><br></div><div>target_compile_options(</div><div>  
mtktool PRIVATE -municode</div><div>)</div><div><br></div><div><br></div><div>Petr<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 30 May 2018 at 04:33, R0b0t1 <span dir="ltr"><<a href="mailto:r030t1@gmail.com" target="_blank">r030t1@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,<br>
<br>
I pass -municode in add_definitions but GCC still complains about the<br>
wrong type on WinMain, citing it needs an LPSTR argument. With<br>
-municode set it should require a LPWSTR and should be named wWinMain.<br>
If I name the function wWinMain the linker complains about a missing<br>
WinMain, which makes no sense. This works when I create a Makefile<br>
myself.<br>
<br>
CMakeLists.txt as follows.<br>
<br>
cmake_minimum_required (VERSION 3.5)<br>
project (mtktool)<br>
<br>
list (<br>
  APPEND<br>
  CMAKE_MODULE_PATH<br>
  "${CMAKE_CURRENT_LIST_DIR}/<wbr>cmake"<br>
)<br>
<br>
set (mtktool_VERSION_MAJOR 0)<br>
set (mtktool_VERSION_MINOR 0)<br>
set (mtktool_VERSION_PATCH 0)<br>
<br>
configure_file (<br>
  "${PROJECT_SOURCE_DIR}/<a href="http://config.h.in" rel="noreferrer" target="_blank">config.<wbr>h.in</a>"<br>
  "${PROJECT_SOURCE_DIR}/config.<wbr>h"<br>
)<br>
<br>
include_directories (<br>
  "${CMAKE_CURRENT_SOURCE_DIR}"<br>
)<br>
<br>
add_definitions (<br>
  -municode<br>
  -mwindows<br>
)<br>
<br>
add_executable (<br>
  mtktool<br>
  mtktool.c<br>
)<br>
<br>
Cheers,<br>
     R0b0t1<br>
-- <br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/<wbr>CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/<wbr>training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/<wbr>opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://cmake.org/mailman/listinfo/cmake" rel="noreferrer" target="_blank">https://cmake.org/mailman/<wbr>listinfo/cmake</a><br>
</blockquote></div><br></div>