From bd7569a05e174a5b88f8ce584491f4192629f6f8 Mon Sep 17 00:00:00 2001
From: Marc Day
Date: Tue, 10 Sep 2013 18:12:24 -0700
Subject: [PATCH] Consolidate all the CMake-built C++ libs into one using the
OBJECT library feature post 2.8.8
---
CMakeLists.txt | 4 ++--
Src/CMakeLists.txt | 8 ++++++++
Src/C_AMRLib/CMakeLists.txt | 3 +--
Src/C_BaseLib/CMakeLists.txt | 3 +--
Src/C_BoundaryLib/CMakeLists.txt | 3 +--
Src/LinearSolvers/C_CellMG/CMakeLists.txt | 3 +--
Src/LinearSolvers/C_TensorMG/CMakeLists.txt | 3 +--
Src/LinearSolvers/C_to_F_MG/CMakeLists.txt | 3 +--
Src/LinearSolvers/F_MG/CMakeLists.txt | 1 -
9 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4b45a13dd1e..86bb6900e1f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,6 @@
# -*- mode: cmake -*-
-# Require cmake 2.8 or higher
-cmake_minimum_required(VERSION 2.8.2)
+# Require cmake 2.8.8 or higher
+cmake_minimum_required(VERSION 2.8.8)
#set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
#set(CMAKE_DISABLE_SOURCE_CHANGES ON)
diff --git a/Src/CMakeLists.txt b/Src/CMakeLists.txt
index 0ebccecec45..3e77e43620a 100644
--- a/Src/CMakeLists.txt
+++ b/Src/CMakeLists.txt
@@ -28,6 +28,14 @@ add_subdirectory(${FBOXDIR})
add_subdirectory(${FMGDIR})
add_subdirectory(${CFMGDIR})
+
+add_library(cboxlib $ $ $ $ $ $)
+add_library(cfboxlib $)
+add_install_library(cboxlib)
+add_install_library(cfboxlib)
+SET_TARGET_PROPERTIES(cboxlib PROPERTIES LINKER_LANGUAGE C)
+SET_TARGET_PROPERTIES(cfboxlib PROPERTIES LINKER_LANGUAGE C)
+
add_subdirectory(${CAMRDATADIR})
add_subdirectory(Extern/gslib)
diff --git a/Src/C_AMRLib/CMakeLists.txt b/Src/C_AMRLib/CMakeLists.txt
index 9e5bdc2855b..a63e65dae8c 100644
--- a/Src/C_AMRLib/CMakeLists.txt
+++ b/Src/C_AMRLib/CMakeLists.txt
@@ -39,10 +39,9 @@ preprocess_boxlib_fortran(FPP_out_files ${FPP_source_files})
set(local_source_files ${FPP_out_files} ${F77_source_files} ${F90_source_files} ${CXX_source_files})
set(local_header_files ${CXX_header_files} ${F77_header_files} ${FPP_header_files} ${F90_header_files})
-add_library(box_camr ${local_source_files})
+add_library(box_camr OBJECT ${local_source_files})
add_install_include_file(${local_header_files})
-add_install_library(box_camr)
if (BUILD_TESTS)
diff --git a/Src/C_BaseLib/CMakeLists.txt b/Src/C_BaseLib/CMakeLists.txt
index e1608b9c10e..d1de4a3b9e5 100644
--- a/Src/C_BaseLib/CMakeLists.txt
+++ b/Src/C_BaseLib/CMakeLists.txt
@@ -27,10 +27,9 @@ set(F90_header_files)
preprocess_boxlib_fortran(FPP_out_files ${FPP_source_files})
set(local_source_files ${CXX_source_files} ${F77_source_files} ${FPP_out_files} ${F90_source_files})
set(local_header_files ${CXX_header_files} ${F77_header_files} ${FPP_header_files} ${F90_header_files})
-add_library(box_c ${local_source_files})
+add_library(box_c OBJECT ${local_source_files})
add_install_include_file(${local_header_files})
-add_install_library(box_c)
#if (BUILD_TESTS AND BL_SPACEDIM EQUAL 3)
# # Add UnitTest include directories
diff --git a/Src/C_BoundaryLib/CMakeLists.txt b/Src/C_BoundaryLib/CMakeLists.txt
index 927e254f35c..3d56c6623df 100644
--- a/Src/C_BoundaryLib/CMakeLists.txt
+++ b/Src/C_BoundaryLib/CMakeLists.txt
@@ -27,10 +27,9 @@ set(F90_header_files)
preprocess_boxlib_fortran(FPP_out_files ${FPP_source_files})
set(local_source_files ${CXX_source_files} ${F77_source_files} ${FPP_out_files} ${F90_source_files})
set(local_header_files ${CXX_header_files} ${F77_header_files} ${FPP_header_files} ${F90_header_files})
-add_library(box_cbndry ${local_source_files})
+add_library(box_cbndry OBJECT ${local_source_files})
add_install_include_file(${local_header_files})
-add_install_library(box_cbndry)
if (BUILD_TESTS)
diff --git a/Src/LinearSolvers/C_CellMG/CMakeLists.txt b/Src/LinearSolvers/C_CellMG/CMakeLists.txt
index 4bbb823c19a..6a3e8f0d889 100644
--- a/Src/LinearSolvers/C_CellMG/CMakeLists.txt
+++ b/Src/LinearSolvers/C_CellMG/CMakeLists.txt
@@ -30,10 +30,9 @@ preprocess_boxlib_fortran(FPP_out_files ${FPP_source_files})
set(local_source_files ${FPP_out_files} ${F77_source_files} ${F90_source_files} ${CXX_source_files})
set(local_header_files ${FPP_header_files} ${F77_header_files} ${F90_header_files} ${CXX_header_files})
-add_library(box_cmg ${local_source_files})
+add_library(box_cmg OBJECT ${local_source_files})
add_install_include_file(${local_header_files})
-add_install_library(box_cmg)
if (BUILD_TESTS)
diff --git a/Src/LinearSolvers/C_TensorMG/CMakeLists.txt b/Src/LinearSolvers/C_TensorMG/CMakeLists.txt
index dcae924e5ca..a893df72a35 100644
--- a/Src/LinearSolvers/C_TensorMG/CMakeLists.txt
+++ b/Src/LinearSolvers/C_TensorMG/CMakeLists.txt
@@ -33,10 +33,9 @@ preprocess_boxlib_fortran(FPP_out_files ${FPP_source_files})
set(local_source_files ${FPP_out_files} ${F77_source_files} ${F90_source_files} ${CXX_source_files})
set(local_header_files ${FPP_header_files} ${F77_header_files} ${F90_header_files} ${CXX_header_files})
-add_library(box_ctmg ${local_source_files})
+add_library(box_ctmg OBJECT ${local_source_files})
add_install_include_file(${local_header_files})
-add_install_library(box_ctmg)
if (BUILD_TESTS)
diff --git a/Src/LinearSolvers/C_to_F_MG/CMakeLists.txt b/Src/LinearSolvers/C_to_F_MG/CMakeLists.txt
index 80a99348966..4306bce46dc 100644
--- a/Src/LinearSolvers/C_to_F_MG/CMakeLists.txt
+++ b/Src/LinearSolvers/C_to_F_MG/CMakeLists.txt
@@ -30,10 +30,9 @@ preprocess_boxlib_fortran(FPP_out_files ${FPP_source_files})
set(local_source_files ${FPP_out_files} ${F77_source_files} ${F90_source_files} ${CXX_source_files})
set(local_header_files ${FPP_header_files} ${F77_header_files} ${F90_header_files} ${CXX_header_files})
-add_library(box_cfmg ${local_source_files})
+add_library(box_cfmg OBJECT ${local_source_files})
add_install_include_file(${local_header_files})
-add_install_library(box_cfmg)
if (BUILD_TESTS)
diff --git a/Src/LinearSolvers/F_MG/CMakeLists.txt b/Src/LinearSolvers/F_MG/CMakeLists.txt
index 5757e334d8a..7f07400cfa9 100644
--- a/Src/LinearSolvers/F_MG/CMakeLists.txt
+++ b/Src/LinearSolvers/F_MG/CMakeLists.txt
@@ -34,7 +34,6 @@ add_library(box_fmg ${local_source_files})
target_link_libraries(box_fmg box_f)
add_install_include_file(${local_header_files})
-add_install_library(box_fmg)
if (BUILD_TESTS AND BL_SPACEDIM EQUAL 3)
endif()