From afe83dc19c1464deb176f38c3ddab80a64e081f4 Mon Sep 17 00:00:00 2001
From: ralfulrich <ralf.ulrich@kit.edu>
Date: Wed, 6 Jan 2021 21:20:42 +0100
Subject: [PATCH] added test main

---
 CMakeLists.txt         | 29 ++++++++++++++++++++++-------
 readLib/CMakeLists.txt |  4 ++++
 2 files changed, 26 insertions(+), 7 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index e034b6d..a0d7617 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,18 +1,39 @@
+#################################
 # Distribution of partly compressed data tables+files for air shower physics
+# Ralf Ulrich, 2020
+#
 
+#################################
+# This CMakeLists.txt may be included in your project
+# to access corsika-data by adding
+# add_subdirectory (corsika_data)
+# to your CMakeLists.txt
+# it creates the cmake taget "CorsikaData"
+# and it builds the libCorsikaData.a archive.
+#
+
+##################################
+# for standalong running
+#
 cmake_minimum_required (VERSION 3.9)
 project (CorsikaData)
 
+###################################
+# set useful varialbles upstream
+#
 get_directory_property (hasParent PARENT_DIRECTORY)
 if (hasParent)
   set (CorsikaData_DIR ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE)
   set (CorsikaData_VERSION "1.1.0" PARENT_SCOPE)
 endif (hasParent)
 
+###################################
+# CorsikaData requires to run with conan, typically inside CORSIKA8
+#
 if (NOT TARGET CONAN_PKG::bzip2)
   message (FATAL_ERROR "Please configure with conan bzip2 package")
 endif (NOT TARGET CONAN_PKG::bzip2)
-
+#
 if (NOT TARGET CONAN_PKG::catch2)
   message (FATAL_ERROR "Please configure with conan catch2 package")
 endif (NOT TARGET CONAN_PKG::catch2)
@@ -24,10 +45,4 @@ else (${CMAKE_VERSION} VERSION_LESS "3.12.0")
   set (CTEST_OUTPUT_ON_FAILURE 1) # this is for new versions of cmake
 endif (${CMAKE_VERSION} VERSION_LESS "3.12.0")
 
-# this may be included in our project to access corsika-data by adding
-# add_subdirectory (corsika-data)
-# to your CMakeLists.txt
-# it creates the cmake taget "CorsikaData"
-# and it builds the libCorsikaData.a archive.
-
 add_subdirectory (readLib)
diff --git a/readLib/CMakeLists.txt b/readLib/CMakeLists.txt
index 393092a..41adbab 100644
--- a/readLib/CMakeLists.txt
+++ b/readLib/CMakeLists.txt
@@ -33,15 +33,19 @@ install (
 
 # add unit test, if run inside CORSIKA
 if (COMMAND CORSIKA_ADD_TEST)
+  message ("CorsikaData found CORSIKA_ADD_TEST")
   if (CORSIKA_DATA_WITH_TEST)
+    message ("CorsikaData, using CORSIKA_ADD_TEST")
     CORSIKA_ADD_TEST (testData SOURCES source/testData.cc)
     target_compile_definitions (
       testData
       PRIVATE
+      STANDALONE=1
       TESTDATA="${CMAKE_CURRENT_SOURCE_DIR}/source/test.data"
       )
   endif (CORSIKA_DATA_WITH_TEST)
 else (COMMAND CORSIKA_ADD_TEST)
+  message ("CorsikaData did not find CORSIKA_ADD_TEST")
   add_executable (testData source/testData.cc)
   target_link_libraries (testData CorsikaData CONAN_PKG::catch2)
   target_compile_options (testData PRIVATE -g) # do not skip asserts
-- 
GitLab