enable_language(C) set (platforms_with_import Windows CYGWIN MSYS) set (GENERATE_CONTENT [[ macro (CHECK_VALUE test_msg value expected) if (NOT "${value}" STREQUAL "${expected}") string (APPEND RunCMake_TEST_FAILED "${test_msg}: actual result:\n [${value}]\nbut expected:\n [${expected}]\n") endif() endmacro() ]]) add_library (shared1 SHARED empty.c) add_library (static1 STATIC empty.c) add_executable (exec1 empty.c) string (APPEND GENERATE_CONTENT "\ncheck_value (\"TARGET_IMPORT_FILE shared library\" \"$\" \"$,${platforms_with_import}>,$,>\") check_value (\"TARGET_LINKER_FILE shared library\" \"$\" \"$,${platforms_with_import}>,$,$>\") check_value (\"TARGET_IMPORT_FILE static library\" \"$\" \"\") check_value (\"TARGET_IMPORT_FILE executable\" \"$\" \"\")\n") set(lib_with_import ${platforms_with_import}) set(exec_with_import ${platforms_with_import}) if (APPLE AND CMAKE_TAPI) list(APPEND lib_with_import Darwin) endif() if (CMAKE_SYSTEM_NAME STREQUAL "AIX") list(APPEND exec_with_import "AIX") endif() set(CMAKE_SHARED_LIBRARY_ENABLE_EXPORTS TRUE) set(CMAKE_EXECUTABLE_ENABLE_EXPORTS TRUE) add_library (shared2 SHARED empty.c) add_executable (exec2 empty.c) string (APPEND GENERATE_CONTENT "\ncheck_value (\"TARGET_IMPORT_FILE shared library\" \"$\" \"$,${lib_with_import}>,$,>\") check_value (\"TARGET_LINKER_FILE shared library\" \"$\" \"$,${lib_with_import}>,$,$>\") check_value (\"TARGET_IMPORT_FILE executable\" \"$\" \"$,${exec_with_import}>,$,>\")\n") file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_IMPORT_FILE-$-generated.cmake" CONTENT "${GENERATE_CONTENT}")