summaryrefslogtreecommitdiff
path: root/Tests/VSExternalInclude
diff options
context:
space:
mode:
Diffstat (limited to 'Tests/VSExternalInclude')
-rw-r--r--Tests/VSExternalInclude/CMakeLists.txt60
-rw-r--r--Tests/VSExternalInclude/Lib1/CMakeLists.txt5
-rw-r--r--Tests/VSExternalInclude/Lib1/lib1.cpp7
-rw-r--r--Tests/VSExternalInclude/Lib1/lib1.h8
-rw-r--r--Tests/VSExternalInclude/Lib2/CMakeLists.txt7
-rw-r--r--Tests/VSExternalInclude/Lib2/lib2.cpp9
-rw-r--r--Tests/VSExternalInclude/Lib2/lib2.h10
-rw-r--r--Tests/VSExternalInclude/main.cpp9
8 files changed, 115 insertions, 0 deletions
diff --git a/Tests/VSExternalInclude/CMakeLists.txt b/Tests/VSExternalInclude/CMakeLists.txt
new file mode 100644
index 000000000..a2fd61973
--- /dev/null
+++ b/Tests/VSExternalInclude/CMakeLists.txt
@@ -0,0 +1,60 @@
+cmake_minimum_required (VERSION 2.6)
+PROJECT(VSExternalInclude)
+
+IF(${CMAKE_GENERATOR} MATCHES "Visual Studio 6")
+ SET(PROJECT_EXT dsp)
+ELSE(${CMAKE_GENERATOR} MATCHES "Visual Studio 6")
+ SET(PROJECT_EXT vcproj)
+ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio 6")
+IF(${CMAKE_GENERATOR} MATCHES "Visual Studio 1[01]")
+ SET(PROJECT_EXT vcxproj)
+ENDIF()
+
+# make sure directories exists
+SET(LIB1_BINARY_DIR ${VSExternalInclude_BINARY_DIR}/Lib1)
+MAKE_DIRECTORY("${LIB1_BINARY_DIR}")
+
+SET(LIB2_BINARY_DIR ${VSExternalInclude_BINARY_DIR}/Lib2)
+MAKE_DIRECTORY("${LIB2_BINARY_DIR}")
+
+# generate lib1
+EXEC_PROGRAM("${CMAKE_COMMAND}" "${LIB1_BINARY_DIR}" ARGS -G\"${CMAKE_GENERATOR}\"
+ \"${VSExternalInclude_SOURCE_DIR}/Lib1\" OUTPUT_VARIABLE OUT)
+MESSAGE("CMAKE Ran with the following output:\n\"${OUT}\"")
+
+# generate lib2
+EXEC_PROGRAM("${CMAKE_COMMAND}" "${LIB2_BINARY_DIR}" ARGS -G\"${CMAKE_GENERATOR}\"
+ \"${VSExternalInclude_SOURCE_DIR}/Lib2\" OUTPUT_VARIABLE OUT)
+MESSAGE("CMAKE Ran with the following output:\n\"${OUT}\"")
+
+
+INCLUDE_EXTERNAL_MSPROJECT(lib1 ${VSExternalInclude_BINARY_DIR}/Lib1/LIB1.${PROJECT_EXT})
+# lib2 depends on lib1
+INCLUDE_EXTERNAL_MSPROJECT(lib2 ${VSExternalInclude_BINARY_DIR}/Lib2/LIB2.${PROJECT_EXT} lib1)
+
+INCLUDE_DIRECTORIES(${VSExternalInclude_SOURCE_DIR}/Lib2 ${VSExternalInclude_SOURCE_DIR}/Lib1)
+
+SET(SOURCES main.cpp)
+
+ADD_EXECUTABLE(VSExternalInclude ${SOURCES})
+
+# target depends on lib2
+ADD_DEPENDENCIES(VSExternalInclude lib2)
+# VS 10 vcxproj files have depends in them
+# Since lib1 and lib2 do not depend on each other
+# then the vcxproj files do not depend on each other
+# and the sln file can no longer be the only source
+# of that depend. So, for VS 10 make the executable
+# depend on lib1 and lib2
+IF(MSVC10 OR MSVC11)
+ ADD_DEPENDENCIES(VSExternalInclude lib1)
+ENDIF()
+
+# Interaction testing between the FOLDER target property and
+# INCLUDE_EXTERNAL_MSPROJECT targets:
+set_target_properties(VSExternalInclude PROPERTIES FOLDER folder1/folder2)
+set_target_properties(lib1 PROPERTIES FOLDER folder1/folder2)
+set_target_properties(lib2 PROPERTIES FOLDER folder1/folder2)
+add_custom_target(EmptyCustomTarget)
+set_target_properties(EmptyCustomTarget PROPERTIES FOLDER folder1/folder2)
+set_property(GLOBAL PROPERTY USE_FOLDERS ON)
diff --git a/Tests/VSExternalInclude/Lib1/CMakeLists.txt b/Tests/VSExternalInclude/Lib1/CMakeLists.txt
new file mode 100644
index 000000000..72ffcedc1
--- /dev/null
+++ b/Tests/VSExternalInclude/Lib1/CMakeLists.txt
@@ -0,0 +1,5 @@
+PROJECT(LIB1)
+
+SET(SOURCES lib1.cpp)
+
+ADD_LIBRARY(lib1 ${SOURCES})
diff --git a/Tests/VSExternalInclude/Lib1/lib1.cpp b/Tests/VSExternalInclude/Lib1/lib1.cpp
new file mode 100644
index 000000000..690eb740f
--- /dev/null
+++ b/Tests/VSExternalInclude/Lib1/lib1.cpp
@@ -0,0 +1,7 @@
+
+#include "lib1.h"
+
+int add1(int num)
+{
+ return num + 1;
+}
diff --git a/Tests/VSExternalInclude/Lib1/lib1.h b/Tests/VSExternalInclude/Lib1/lib1.h
new file mode 100644
index 000000000..543e71e02
--- /dev/null
+++ b/Tests/VSExternalInclude/Lib1/lib1.h
@@ -0,0 +1,8 @@
+
+#ifndef LIB1_HPP
+#define LIB1_HPP
+
+int add1(int num);
+
+
+#endif
diff --git a/Tests/VSExternalInclude/Lib2/CMakeLists.txt b/Tests/VSExternalInclude/Lib2/CMakeLists.txt
new file mode 100644
index 000000000..31e40e4e1
--- /dev/null
+++ b/Tests/VSExternalInclude/Lib2/CMakeLists.txt
@@ -0,0 +1,7 @@
+PROJECT(VSEXTERNAL_LIB2)
+
+INCLUDE_DIRECTORIES(${VSEXTERNAL_LIB2_SOURCE_DIR}/../Lib1)
+
+SET(SOURCES lib2.cpp)
+
+ADD_LIBRARY(lib2 ${SOURCES})
diff --git a/Tests/VSExternalInclude/Lib2/lib2.cpp b/Tests/VSExternalInclude/Lib2/lib2.cpp
new file mode 100644
index 000000000..adc2d29af
--- /dev/null
+++ b/Tests/VSExternalInclude/Lib2/lib2.cpp
@@ -0,0 +1,9 @@
+
+#include "lib2.h"
+#include "lib1.h"
+
+int add1_and_mult2(int num)
+{
+ int tmp = add1(num);
+ return tmp * 2;
+}
diff --git a/Tests/VSExternalInclude/Lib2/lib2.h b/Tests/VSExternalInclude/Lib2/lib2.h
new file mode 100644
index 000000000..48bda468d
--- /dev/null
+++ b/Tests/VSExternalInclude/Lib2/lib2.h
@@ -0,0 +1,10 @@
+
+
+#ifndef LIB2_HPP
+#define LIB2_HPP
+
+#include "lib1.h"
+
+int add1_and_mult2(int num);
+
+#endif
diff --git a/Tests/VSExternalInclude/main.cpp b/Tests/VSExternalInclude/main.cpp
new file mode 100644
index 000000000..ea1047cb6
--- /dev/null
+++ b/Tests/VSExternalInclude/main.cpp
@@ -0,0 +1,9 @@
+
+#include "lib2.h"
+
+int main(int argc, char** argv)
+{
+ int num = add1_and_mult2(4);
+
+ return 0;
+}