Tests: Cleanup RunCMake.GenerateExportHeader somewhat
This commit is contained in:
parent
fc3dab0ea9
commit
72ecdd34cf
|
@ -1,3 +1,3 @@
|
|||
cmake_minimum_required(VERSION 2.8.5)
|
||||
cmake_minimum_required(VERSION 3.6)
|
||||
project(${RunCMake_TEST} NONE)
|
||||
include(${RunCMake_TEST}.cmake)
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
.*
|
|
@ -1,23 +1,8 @@
|
|||
cmake_minimum_required(VERSION 2.8.5 FATAL_ERROR)
|
||||
cmake_policy(SET CMP0054 NEW)
|
||||
# Test add_compiler_export_flags without deprecation warning.
|
||||
set(CMAKE_WARN_DEPRECATED OFF)
|
||||
|
||||
project(GenerateExportHeader)
|
||||
|
||||
# Prevent timeout on Watcom by not running the tests.
|
||||
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES Watcom)
|
||||
file(WRITE
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/main.cxx"
|
||||
"int main() { return 0; }
|
||||
"
|
||||
)
|
||||
|
||||
add_executable(
|
||||
GenerateExportHeader
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/main.cxx"
|
||||
)
|
||||
return()
|
||||
endif()
|
||||
|
||||
include(CheckCXXCompilerFlag)
|
||||
|
||||
set( CMAKE_INCLUDE_CURRENT_DIR ON )
|
||||
|
@ -80,16 +65,16 @@ add_compiler_export_flags()
|
|||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
message("#### COMPILER_HAS_DEPRECATED: " ${COMPILER_HAS_DEPRECATED})
|
||||
message("#### COMPILER_HAS_HIDDEN_VISIBILITY: " ${COMPILER_HAS_HIDDEN_VISIBILITY})
|
||||
message("#### WIN32: " ${WIN32})
|
||||
message("#### HAS_WERROR_FLAG: " ${HAS_WERROR_FLAG})
|
||||
message(STATUS "COMPILER_HAS_DEPRECATED: " ${COMPILER_HAS_DEPRECATED})
|
||||
message(STATUS "COMPILER_HAS_HIDDEN_VISIBILITY: " ${COMPILER_HAS_HIDDEN_VISIBILITY})
|
||||
message(STATUS "WIN32: " ${WIN32})
|
||||
message(STATUS "HAS_WERROR_FLAG: " ${HAS_WERROR_FLAG})
|
||||
|
||||
set(link_libraries)
|
||||
macro(macro_add_test_library name)
|
||||
add_subdirectory(${name})
|
||||
include_directories(${name}
|
||||
${${name}_BINARY_DIR} # For the export header.
|
||||
${CMAKE_CURRENT_BINARY_DIR}/${name} # For the export header.
|
||||
)
|
||||
list(APPEND link_libraries ${name})
|
||||
endmacro()
|
||||
|
@ -132,7 +117,7 @@ elseif(COMPILER_HAS_DEPRECATED)
|
|||
else()
|
||||
set(_platform Empty)
|
||||
endif()
|
||||
message("#### Testing reference: ${_platform}")
|
||||
message(STATUS "Testing reference: ${_platform}")
|
||||
target_compile_definitions(GenerateExportHeader
|
||||
PRIVATE
|
||||
"SRC_DIR=\"${CMAKE_CURRENT_SOURCE_DIR}/reference/${_platform}\""
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
project(c_identifier)
|
||||
|
||||
set(c_identifier_lib_SRCS
|
||||
c_identifier_class.cpp
|
||||
)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
#include "c_identifier_class.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
int main()
|
||||
{
|
||||
CIdentifierClass cic;
|
||||
return cic.someMethod();
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
project(lib_shared_and_static)
|
||||
|
||||
include(GenerateExportHeader)
|
||||
|
||||
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
||||
|
@ -33,6 +28,6 @@ generate_export_header(shared_variant
|
|||
CUSTOM_CONTENT_FROM_VARIABLE MY_CUSTOM_CONTENT
|
||||
)
|
||||
|
||||
set_target_properties(static_variant PROPERTIES COMPILE_FLAGS -DLIBSHARED_AND_STATIC_STATIC_DEFINE)
|
||||
target_compile_definitions(static_variant PUBLIC MYPREFIX_LIBSHARED_AND_STATIC_STATIC_DEFINE)
|
||||
|
||||
export(TARGETS shared_variant static_variant FILE Targets.cmake)
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
project(libshared)
|
||||
|
||||
include(GenerateExportHeader)
|
||||
|
||||
add_compiler_export_flags()
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
|
||||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
project(libstatic)
|
||||
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
|
||||
include(GenerateExportHeader)
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
project(nodeprecated)
|
||||
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/nodeprecated_defined)
|
||||
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_BINARY_DIR}/nodeprecated_not_defined)
|
||||
|
||||
|
@ -23,4 +19,4 @@ try_compile(Result ${CMAKE_CURRENT_BINARY_DIR}/nodeprecated_defined_build
|
|||
OUTPUT_VARIABLE Out
|
||||
)
|
||||
|
||||
test_fail(Result "Built even with no-deprecated define")
|
||||
test_fail(Result "Built even with no-deprecated define")
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
cmake_minimum_required(VERSION 2.8)
|
||||
cmake_minimum_required(VERSION 3.6)
|
||||
|
||||
project(nodeprecated_test)
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
|
||||
#include "someclass.h"
|
||||
|
||||
int main(int, char**)
|
||||
int main()
|
||||
{
|
||||
SomeClass sc;
|
||||
sc.someMethod();
|
||||
|
|
Loading…
Reference in New Issue