compiler_depend.make:4: *** multiple target patterns. Stop. (Windows Path issue while using cmake)
11:24 20 Apr 2026

I'm writing C code on a windows machine, this is my setup:

  1. MSYS with the UCRT64 environment.

  2. VSCode

  3. CMake to build with "Unix Makefiles" generator

Project directory looks like this:

.vscode
build
scripts
src/lib
CMakeLists.txt
Variables.cmake

root CMakeLists.txt

# SPDX-License-Identifier: Unlicense
# Author: Derrick Lyndon Pallas 

cmake_minimum_required(VERSION 3.10)

set(PROJECT hangman )
project(${PROJECT} LANGUAGES C VERSION 1.0.0 DESCRIPTION "Fun hangman game")

# Get CFILES, HFILES, CFILES, HFILES, RCFILES variables
include("${CMAKE_CURRENT_SOURCE_DIR}/Variables.cmake")

#get internal library
add_subdirectory(src/lib)

add_executable(${PROJECT} ${CFILES} ${HFILES})
target_link_libraries(${PROJECT} PUBLIC libhangman)
target_include_directories(${PROJECT} PRIVATE src/lib/include)
//Variables.cmake

set( CFILES 
"src/core.c"
"src/words.c"
"src/main.c"
)

set( HFILES 
"src/core.h"
"src/words.h"
)

//  ./src/lib/Variables.cmake

set( CFILES 
    "utils/ft_strlen.c"
    "utils/ft_strcmp.c"
    "utils/ft_strlcpy.c"
    "utils/ft_atoi.c"
    "utils/ft_itoa.c"
    "utils/ft_get_next_line_one_byte.c"
    "printers/ft_printers.c"
    "printers/ft_putchar.c"
    "printers/ft_putnbr.c" 
    "printers/ft_putstr.c"
    "printers/ft_putchar_fd.c"
    "printers/ft_putstr_fd.c"
)

set( HFILES 
"include/utils.h"
"include/printers.h"
)

./src/lib/include/(*.h files)

./src/lib/printers/(*.c files)

./src/lib/utils/(*.c files)

---> and this is the ./src/lib/CMakeLists.txt

# SPDX-License-Identifier: Unlicense
# Author: Derrick Lyndon Pallas 

cmake_minimum_required(VERSION 3.10)

set(LIB_NAME libhangman)

include("${CMAKE_CURRENT_SOURCE_DIR}/Variables.cmake")

add_library(${LIB_NAME} STATIC ${CFILES} ${HFILES})

target_include_directories(${LIB_NAME} PUBLIC include)

builds fine and I can compile with Make the 1st time, but after solving an error and compiling for 2nd time, it throws me the following error

PS C:\Users\duria\projects\c\hangman\build> make

src/lib/CMakeFiles/libhangman.dir/compiler_depend.make:4: *** multiple target patterns.  Stop.

make[1]: *** [CMakeFiles/Makefile2:140: src/lib/CMakeFiles/libhangman.dir/all] Error 2

make: *** [Makefile:91: all] Error 2

When taking a look at the line with the issue:

/libhangman.dir/compiler_depend.make:4:
src/lib/CMakeFiles/libhangman.dir/printers/ft_printers.c.o: /c/Users/duria/projects/c/hangman/src/lib/printers/ft_printers.c \
  src/lib/C:/Users/duria/projects/c/hangman/src/lib/include/printers.h \
  src/lib/C:/Users/duria/projects/c/hangman/src/lib/printers/ft_printers.c \
  src/lib/C:/msys64/ucrt64/include/_mingw.h \ //<-- the windows Path "C:" is causing the issue
  src/lib/C:/msys64/ucrt64/include/_mingw_mac.h \
  src/lib/C:/msys64/ucrt64/include/_mingw_off_t.h \

There is any solution for this

What I want to build --> 1 executable, it has a library (internal) for utilities used.

c cmake makefile