Describe the bug
I tried to switch to xmake yesterday when I got this bug, it seems .cpp are not recompiled when a .hpp changes on Windows.
I reproduced the problem using a very small project, here are the files:
src/headerA.hpp:
constexpr int ValueA = 254;
src/headerB.hpp:
#include "headerA.hpp"
constexpr int ValueB = 42;
src/headerC.hpp:
#include "headerB.hpp"
constexpr int ValueC = 124;
src/main.cpp:
#include "headerC.hpp"
#include <iostream>
int main(int argc, char** argv)
{
std::cout << "A: " << ValueA << std::endl;
std::cout << "B: " << ValueB << std::endl;
std::cout << "C: " << ValueC << std::endl;
}
xmake.lua:
add_rules("mode.debug", "mode.release")
target("test_recompilation")
set_kind("binary")
add_headerfiles("src/*.hpp")
add_files("src/*.cpp")
When I change any value in the header, the main.cpp is not recompiled and outputs the old values.
This bug doesn't occurs on Linux.
Expected behavior
That when changing any header file, all .cpp including it (even not directly) are compiled.
Error output
lynix@SirLynixVanDesktop:/mnt/c/Projets/Tests/xmake-build/test_recompilation$ cat src/headerB.hpp
#pragma once
#include "headerA.hpp"
constexpr int ValueB = 43;
lynix@SirLynixVanDesktop:/mnt/c/Projets/Tests/xmake-build/test_recompilation$ xmake.exe
[100%]: build ok!
lynix@SirLynixVanDesktop:/mnt/c/Projets/Tests/xmake-build/test_recompilation$ xmake.exe run
A: 255
B: 42
C: 123
Note the B value is the previous one.
(Please note also I'm on WSL so I have access to Linux cat command but I'm using the Windows xmake version)
Related Environment
Please provide compiling and running environment information:
- xmake version: v2.3.9+202011250023
- os: Windows 10 2004
- target platform: Windows
Describe the bug
I tried to switch to xmake yesterday when I got this bug, it seems .cpp are not recompiled when a .hpp changes on Windows.
I reproduced the problem using a very small project, here are the files:
src/headerA.hpp:
src/headerB.hpp:
src/headerC.hpp:
src/main.cpp:
xmake.lua:
When I change any value in the header, the main.cpp is not recompiled and outputs the old values.
This bug doesn't occurs on Linux.
Expected behavior
That when changing any header file, all .cpp including it (even not directly) are compiled.
Error output
Note the B value is the previous one.
(Please note also I'm on WSL so I have access to Linux cat command but I'm using the Windows xmake version)
Related Environment
Please provide compiling and running environment information: