[Cmake-commits] CMake branch, next, updated. v2.8.8-3355-ge4582fc
Peter Kuemmel
syntheticpp at gmx.net
Tue Jul 3 06:39:42 EDT 2012
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".
The branch, next has been updated
via e4582fce9e972c56314184add8c06d8586977c8b (commit)
via e7b7772315de09e5d1d6e8e679456010957708bb (commit)
from 986f78a1b24c441cb9c344852d8ee4857e48c15f (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e4582fce9e972c56314184add8c06d8586977c8b
commit e4582fce9e972c56314184add8c06d8586977c8b
Merge: 986f78a e7b7772
Author: Peter Kuemmel <syntheticpp at gmx.net>
AuthorDate: Tue Jul 3 06:39:36 2012 -0400
Commit: CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Tue Jul 3 06:39:36 2012 -0400
Merge topic 'BuildTypeFlag' into next
e7b7772 add BuildTypeFlag test
http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=e7b7772315de09e5d1d6e8e679456010957708bb
commit e7b7772315de09e5d1d6e8e679456010957708bb
Author: Peter Kuemmel <syntheticpp at gmx.net>
AuthorDate: Tue Jul 3 12:37:57 2012 +0200
Commit: Peter Kuemmel <syntheticpp at gmx.net>
CommitDate: Tue Jul 3 12:37:57 2012 +0200
add BuildTypeFlag test
diff --git a/Tests/BuildTypeFlags/CMakeLists.txt b/Tests/BuildTypeFlags/CMakeLists.txt
new file mode 100644
index 0000000..c2dcc43
--- /dev/null
+++ b/Tests/BuildTypeFlags/CMakeLists.txt
@@ -0,0 +1,33 @@
+cmake_minimum_required(VERSION 2.8)
+
+project(flags C)
+
+enable_testing()
+include(CTest)
+
+if(NOT CMAKE_BUILD_TYPE)
+ set(CMAKE_BUILD_TYPE Debug)
+endif()
+
+message(STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
+
+set(CMAKE_C_FLAGS)
+set(CMAKE_C_FLAGS_DEBUG
+ "${CMAKE_C_FLAGS_DEBUG} -DFLAG=\\\"${CMAKE_BUILD_TYPE}\\\"")
+set(CMAKE_C_FLAGS_MINSIZEREL
+ "${CMAKE_C_FLAGS_MINSIZEREL} -DFLAG=\\\"${CMAKE_BUILD_TYPE}\\\"")
+set(CMAKE_C_FLAGS_RELEASE
+ "${CMAKE_C_FLAGS_RELEASE} -DFLAG=\\\"${CMAKE_BUILD_TYPE}\\\"")
+set(CMAKE_C_FLAGS_RELWITHDEBINFO
+ "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DFLAG=\\\"${CMAKE_BUILD_TYPE}\\\"")
+
+add_library(lib STATIC lib.c)
+add_library(lib_shared SHARED lib.c)
+
+add_executable(flags flags.c)
+target_link_libraries(flags lib)
+
+add_test( NAME flags_set COMMAND flags)
+
+set_tests_properties(flags_set PROPERTIES
+ PASS_REGULAR_EXPRESSION " ${CMAKE_BUILD_TYPE}")
diff --git a/Tests/BuildTypeFlags/flags.c b/Tests/BuildTypeFlags/flags.c
new file mode 100644
index 0000000..25d3479
--- /dev/null
+++ b/Tests/BuildTypeFlags/flags.c
@@ -0,0 +1,15 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "lib.h"
+
+#ifndef FLAG
+#define FLAG "not given"
+#endif
+
+int main(int argc, char* argv[])
+{
+ printf("Flag: %s -> %s\n", argv[0], FLAG);
+ lib();
+ return EXIT_SUCCESS;
+}
diff --git a/Tests/BuildTypeFlags/lib.c b/Tests/BuildTypeFlags/lib.c
new file mode 100644
index 0000000..5936a06
--- /dev/null
+++ b/Tests/BuildTypeFlags/lib.c
@@ -0,0 +1,13 @@
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "lib.h"
+
+#ifndef FLAG
+#define FLAG "not given"
+#endif
+
+void lib()
+{
+ printf("Lib: %s\n", FLAG);
+}
diff --git a/Tests/BuildTypeFlags/lib.h b/Tests/BuildTypeFlags/lib.h
new file mode 100644
index 0000000..d538ac2
--- /dev/null
+++ b/Tests/BuildTypeFlags/lib.h
@@ -0,0 +1 @@
+void lib();
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index 9deb8ac..1677165 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -625,6 +625,16 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
)
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BuildDepends")
+ ADD_TEST(BuildTypeFlags ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/BuildTypeFlags"
+ "${CMake_BINARY_DIR}/Tests/BuildTypeFlags"
+ --build-generator ${CMAKE_TEST_GENERATOR}
+ --build-project BuildTypeFlags
+ --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
+ )
+ LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/BuildTypeFlags")
+
SET(SimpleInstallInstallDir
"${CMake_BINARY_DIR}/Tests/SimpleInstall/InstallDirectory")
ADD_TEST(SimpleInstall ${CMAKE_CTEST_COMMAND}
-----------------------------------------------------------------------
Summary of changes:
Tests/BuildTypeFlags/CMakeLists.txt | 33 +++++++++++++++++++++++++++++++++
Tests/BuildTypeFlags/flags.c | 15 +++++++++++++++
Tests/BuildTypeFlags/lib.c | 13 +++++++++++++
Tests/BuildTypeFlags/lib.h | 1 +
Tests/CMakeLists.txt | 10 ++++++++++
5 files changed, 72 insertions(+), 0 deletions(-)
create mode 100644 Tests/BuildTypeFlags/CMakeLists.txt
create mode 100644 Tests/BuildTypeFlags/flags.c
create mode 100644 Tests/BuildTypeFlags/lib.c
create mode 100644 Tests/BuildTypeFlags/lib.h
hooks/post-receive
--
CMake
More information about the Cmake-commits
mailing list