Marcelo Fornet 4 anni fa
commit
27d64f4c00
13 ha cambiato i file con 68 aggiunte e 0 eliminazioni
  1. 1 0
      .gitignore
  2. 0 0
      README.md
  3. 12 0
      bad/CMakeLists.txt
  4. 4 0
      bad/lib/a.hpp
  5. 4 0
      bad/src/main.cpp
  6. 6 0
      bad/src/x.cpp
  7. 6 0
      bad/src/y.cpp
  8. 12 0
      good/CMakeLists.txt
  9. 6 0
      good/lib/a.cpp
  10. 1 0
      good/lib/a.hpp
  11. 4 0
      good/src/main.cpp
  12. 6 0
      good/src/x.cpp
  13. 6 0
      good/src/y.cpp

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+build/

+ 0 - 0
README.md


+ 12 - 0
bad/CMakeLists.txt

@@ -0,0 +1,12 @@
+cmake_minimum_required(VERSION 3.16)
+
+project(test)
+
+set(CMAKE_CXX_STANDARD 17)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+
+include_directories(lib)
+
+file(GLOB_RECURSE SOURCES "lib/*.cpp" "src/*.cpp" "main.cpp")
+
+add_executable(test ${SOURCES})

+ 4 - 0
bad/lib/a.hpp

@@ -0,0 +1,4 @@
+int f()
+{
+    return 2;
+}

+ 4 - 0
bad/src/main.cpp

@@ -0,0 +1,4 @@
+int main()
+{
+    return 0;
+}

+ 6 - 0
bad/src/x.cpp

@@ -0,0 +1,6 @@
+#include "a.hpp"
+
+int g()
+{
+    return f() + 2;
+}

+ 6 - 0
bad/src/y.cpp

@@ -0,0 +1,6 @@
+#include "a.hpp"
+
+int h()
+{
+    return f() + 3;
+}

+ 12 - 0
good/CMakeLists.txt

@@ -0,0 +1,12 @@
+cmake_minimum_required(VERSION 3.16)
+
+project(test)
+
+set(CMAKE_CXX_STANDARD 17)
+set(CMAKE_CXX_STANDARD_REQUIRED ON)
+
+include_directories(lib)
+
+file(GLOB_RECURSE SOURCES "lib/*.cpp" "src/*.cpp" "main.cpp")
+
+add_executable(test ${SOURCES})

+ 6 - 0
good/lib/a.cpp

@@ -0,0 +1,6 @@
+#include "a.hpp"
+
+int f()
+{
+    return 2;
+}

+ 1 - 0
good/lib/a.hpp

@@ -0,0 +1 @@
+int f();

+ 4 - 0
good/src/main.cpp

@@ -0,0 +1,4 @@
+int main()
+{
+    return 0;
+}

+ 6 - 0
good/src/x.cpp

@@ -0,0 +1,6 @@
+#include "a.hpp"
+
+int g()
+{
+    return f() + 2;
+}

+ 6 - 0
good/src/y.cpp

@@ -0,0 +1,6 @@
+#include "a.hpp"
+
+int h()
+{
+    return f() + 3;
+}