@@ -71,3 +71,59 @@ def test_output_argument(monkeypatch, tmp_path, output_arg):
7171 build_files = {x .name for x in build_dir .iterdir ()}
7272 assert f"{ generated_file } .dep" in build_files
7373 assert generated_file in build_files
74+
75+
76+ def test_implicit_cxx (monkeypatch , tmp_path ):
77+ package_dir = tmp_path / "pkg3"
78+ shutil .copytree (DIR / "packages/simple" , package_dir )
79+ monkeypatch .chdir (package_dir )
80+
81+ cmakelists = Path ("CMakeLists.txt" )
82+ txt = (
83+ cmakelists .read_text ()
84+ .replace ("LANGUAGE C" , "" )
85+ .replace ("LANGUAGES C" , "LANGUAGES CXX" )
86+ )
87+ cmakelists .write_text (txt )
88+
89+ wheel = build_wheel (
90+ str (tmp_path ), {"build-dir" : "build" , "wheel.license-files" : []}
91+ )
92+
93+ with zipfile .ZipFile (tmp_path / wheel ) as f :
94+ file_names = set (f .namelist ())
95+ assert len (file_names ) == 4
96+
97+ build_files = {x .name for x in Path ("build" ).iterdir ()}
98+ assert "simple.cxx.dep" in build_files
99+ assert "simple.cxx" in build_files
100+
101+
102+ def test_directive_cxx (monkeypatch , tmp_path ):
103+ package_dir = tmp_path / "pkg4"
104+ shutil .copytree (DIR / "packages/simple" , package_dir )
105+ monkeypatch .chdir (package_dir )
106+
107+ cmakelists = Path ("CMakeLists.txt" )
108+ txt = (
109+ cmakelists .read_text ()
110+ .replace ("LANGUAGE C" , "" )
111+ .replace ("LANGUAGES C" , "LANGUAGES CXX" )
112+ )
113+ cmakelists .write_text (txt )
114+
115+ simple = Path ("simple.pyx" )
116+ txt = simple .read_text ()
117+ simple .write_text (f"# distutils: language=c++\n { txt } " )
118+
119+ wheel = build_wheel (
120+ str (tmp_path ), {"build-dir" : "build" , "wheel.license-files" : []}
121+ )
122+
123+ with zipfile .ZipFile (tmp_path / wheel ) as f :
124+ file_names = set (f .namelist ())
125+ assert len (file_names ) == 4
126+
127+ build_files = {x .name for x in Path ("build" ).iterdir ()}
128+ assert "simple.cxx.dep" in build_files
129+ assert "simple.cxx" in build_files
0 commit comments