Skip to content

Commit

Permalink
Remove ENABLE_SHARED_LIBS. Fix gtest not playing nicely when included…
Browse files Browse the repository at this point in the history
… in cmake projects
  • Loading branch information
white238 committed May 16, 2018
1 parent b2f3082 commit 45bb7ff
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 19 deletions.
2 changes: 1 addition & 1 deletion SetupBLT.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ if (NOT BLT_LOADED)
# Global variables needed by BLT
#
################################
set(BLT_C_FILE_EXTS ".cpp" ".hpp" ".cxx" ".hxx" ".cc" ".c" ".h" ".hh" ".inl"
set(BLT_C_FILE_EXTS ".cpp" ".hpp" ".cxx" ".hxx" ".cc" ".c" ".h" ".hh" ".inl" ".cu"
CACHE LIST "List of known file extensions used for C/CXX sources")
set(BLT_Fortran_FILE_EXTS ".F" ".f" ".f90" ".F90"
CACHE LIST "List of known file extensions used for Fortran sources")
Expand Down
4 changes: 2 additions & 2 deletions cmake/BLTMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ endmacro(blt_register_library)
## )
##
## Adds a library target, called <libname>, to be built from the given sources.
## This macro uses the ENABLE_SHARED_LIBS, which is defaulted to OFF, to determine
## This macro uses the BUILD_SHARED_LIBS, which is defaulted to OFF, to determine
## whether the library will be build as shared or static. The optional boolean
## SHARED argument can be used to override this choice.
##
Expand Down Expand Up @@ -368,7 +368,7 @@ macro(blt_add_library)

# Determine whether to build as a shared library. Default to global variable unless
# SHARED parameter is specified
set(_build_shared_library ${ENABLE_SHARED_LIBS})
set(_build_shared_library ${BUILD_SHARED_LIBS})
if( DEFINED arg_SHARED )
set(_build_shared_library ${arg_SHARED})
endif()
Expand Down
13 changes: 4 additions & 9 deletions cmake/BLTOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,6 @@ endif()
option(ENABLE_COPY_HEADERS "Copy headers to build directory" OFF)
option(ENABLE_FORTRAN "Enables Fortran compiler support" ${_fortran_already_enabled})

# Make sure these are the same
if(DEFINED BUILD_SHARED_LIBS)
set(_build_shared_libs ${BUILD_SHARED_LIBS})
else()
set(_build_shared_libs OFF)
endif()
option(ENABLE_SHARED_LIBS "Enables shared libraries." ${_build_shared_libs})
set(BUILD_SHARED_LIBS ${ENABLE_SHARED_LIBS})

option(ENABLE_MPI "Enables MPI support" OFF)
option(ENABLE_OPENMP "Enables OpenMP compiler support" OFF)
option(ENABLE_CUDA "Enable CUDA support" OFF)
Expand Down Expand Up @@ -154,3 +145,7 @@ mark_as_advanced(
ENABLE_GTEST_DEATH_TESTS
ENABLE_WRAP_ALL_TESTS_WITH_MPIEXEC )

if (DEFINED ENABLE_SHARED_LIBS)
message(FATAL_ERROR "ENABLE_SHARED_LIBS is a deprecated BLT option."
"Use the standard CMake option, BUILD_SHARED_LIBS, instead.")
endif()
2 changes: 1 addition & 1 deletion cmake/SetupCompilerOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ endif()
# RPath Settings
################################
# only apply rpath settings for builds using shared libs
if(ENABLE_SHARED_LIBS)
if(BUILD_SHARED_LIBS)
# use, i.e. don't skip the full RPATH for the build tree
set(CMAKE_SKIP_BUILD_RPATH FALSE)

Expand Down
2 changes: 1 addition & 1 deletion docs/creating_execs_and_libs.rst
Original file line number Diff line number Diff line change
Expand Up @@ -122,5 +122,5 @@ more work or CMake function calls.
given sources and headers along with handling dependencies the same way as ``blt_add_executable``
does. It also provides a few commonly used build options, such as overriding the output name of the
library and the output directory. It defaults to building a static library unless you override it with
``SHARED`` or with the global BLT option ``ENABLE_SHARED_LIBS``.
``SHARED`` or with the global CMake option ``BUILD_SHARED_LIBS``.

4 changes: 1 addition & 3 deletions docs/tutorial/calc_pi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ endif()

include(${BLT_SOURCE_DIR}/SetupBLT.cmake)

if(WIN32 AND ENABLE_SHARED_LIBS)
if(WIN32 AND BUILD_SHARED_LIBS)
add_definitions("-DWIN32_SHARED_LIBS")
endif()

Expand All @@ -28,8 +28,6 @@ endif()
blt_add_executable( NAME example_1
SOURCES example_1.cpp )



###############################################################################
# Example 2: Creating a library and an executable using our library.
###############################################################################
Expand Down
2 changes: 1 addition & 1 deletion tests/internal/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ endif()

include(${BLT_SOURCE_DIR}/SetupBLT.cmake)

if(WIN32 AND ENABLE_SHARED_LIBS)
if(WIN32 AND BUILD_SHARED_LIBS)
add_definitions("-DWIN32_SHARED_LIBS")
endif()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ option(
"Build gtest with internal symbols hidden in shared libraries."
OFF)

set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Generate debug library name with a postfix.")
# BLT FIX - This is causes global issues where it adds 'd' to the end of library names when
# building debug libraries. It has been fixed in the newer gtest
#set(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "Generate debug library name with a postfix.")
# END BLT FIX

# Defines pre_project_set_up_hermetic_build() and set_up_hermetic_build().
include(cmake/hermetic_build.cmake OPTIONAL)
Expand Down

0 comments on commit 45bb7ff

Please sign in to comment.