enable_language (C) set (win_platforms 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_executable (exec1 IMPORTED) add_library (shared1 SHARED IMPORTED) add_library (static1 STATIC IMPORTED) string (APPEND GENERATE_CONTENT "\ncheck_value (\"TARGET_FILE_SUFFIX executable default\" \"$\" \"${CMAKE_EXECUTABLE_SUFFIX}\") check_value (\"TARGET_FILE_SUFFIX shared default\" \"$\" \"${CMAKE_SHARED_LIBRARY_SUFFIX}\") check_value (\"TARGET_LINKER_FILE_SUFFIX shared linker default\" \"$\" \"$,${win_platforms}>,${CMAKE_IMPORT_LIBRARY_SUFFIX},${CMAKE_SHARED_LIBRARY_SUFFIX}>\") check_value (\"TARGET_FILE_SUFFIX static default\" \"$\" \"${CMAKE_STATIC_LIBRARY_SUFFIX}\") check_value (\"TARGET_LINKER_FILE_SUFFIX static linker default\" \"$\" \"${CMAKE_STATIC_LIBRARY_SUFFIX}\")\n") add_executable (exec2 IMPORTED) set_property (TARGET exec2 PROPERTY SUFFIX exec2_suffix) set_property (TARGET exec2 PROPERTY ENABLE_EXPORTS TRUE) set_property (TARGET exec2 PROPERTY IMPORT_SUFFIX exec2_import_suffix) add_library (shared2 SHARED IMPORTED) set_property (TARGET shared2 PROPERTY SUFFIX shared2_suffix) set_property (TARGET shared2 PROPERTY IMPORT_SUFFIX shared2_import_suffix) add_library (static2 STATIC IMPORTED) set_property (TARGET static2 PROPERTY SUFFIX static2_suffix) set_property (TARGET static2 PROPERTY IMPORT_SUFFIX static2_import_suffix) string (APPEND GENERATE_CONTENT "\ncheck_value (\"TARGET_FILE_SUFFIX executable custom\" \"$\" \"exec2_suffix\") check_value (\"TARGET_LINKER_FILE_SUFFIX executable linker custom\" \"$\" \"$,${win_platforms};AIX>,exec2_import_suffix,exec2_suffix>\") check_value (\"TARGET_FILE_SUFFIX shared custom\" \"$\" \"shared2_suffix\") check_value (\"TARGET_LINKER_FILE_SUFFIX shared linker custom\" \"$\" \"$,${win_platforms}>,shared2_import_suffix,shared2_suffix>\") check_value (\"TARGET_FILE_SUFFIX static custom\" \"$\" \"static2_suffix\") check_value (\"TARGET_LINKER_FILE_SUFFIX static linker custom\" \"$\" \"static2_suffix\")\n") file (GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/TARGET_FILE_SUFFIX-generated.cmake" CONTENT "${GENERATE_CONTENT}")