My CMakeLists.txt
file for windows is the following.
cmake_minimum_required(VERSION 3.5)
project(LogMsg)
# Set the project source files
set(SOURCES
LogMsg.cpp
LogMsgMain.rc
LogMsg.h
resource.h
stdafx.h
)
# Add executable target
add_library(LogMsg SHARED ${SOURCES})
# Set the configuration-specific outputs
set_target_properties(LogMsg PROPERTIES
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_CURRENT_SOURCE_DIR}/Debug"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_CURRENT_SOURCE_DIR}/Release"
)
# Add include directories
target_include_directories(LogMsg PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
# Specify custom build commands
add_custom_command(TARGET LogMsg POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/LogMsg.rc" "$<TARGET_FILE_DIR:LogMsg>"
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/LogMsg.h" "$<TARGET_FILE_DIR:LogMsg>"
)
I run:
cmake -G "Visual Studio 17 2022" -S . -B .
cmake --build . --config Release
Within the Release
subfolder I am getting .dll file, .rc and .h file.
However, directory LogMsg.tlog
and some other files such as: LogMsg.dll.recipe
, LogMsg.obj
and LogMsgMain.res
are generated within the path LogMsg.dir/Release
and I cannot find how is this defined since I would like it in the Release
folder immediately.