diff --git a/CHECKLST.txt b/CHECKLST.txt index c3a5365a..82fc9d6a 100644 --- a/CHECKLST.txt +++ b/CHECKLST.txt @@ -37,6 +37,9 @@ Things to do during the branch-stabilisation period: particular, any headline features for the release should get a workout with memory checking enabled! + - Test the CMake build scripts with the oldest CMake they claim to + support, on both Unix and Windows. + Making a release candidate build -------------------------------- diff --git a/CMakeLists.txt b/CMakeLists.txt index 299f04c4..16a0bc96 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.7) project(putty LANGUAGES C) include(cmake/setup.cmake) diff --git a/cmake/setup.cmake b/cmake/setup.cmake index c0965c49..6612de97 100644 --- a/cmake/setup.cmake +++ b/cmake/setup.cmake @@ -55,9 +55,19 @@ add_custom_target(cmake_commit_c DEPENDS check_git_commit ${INTERMEDIATE_COMMIT_C} COMMENT "Updating cmake_commit.c") +if(CMAKE_VERSION VERSION_LESS 3.12) + function(add_compile_definitions) + foreach(i ${ARGN}) + add_compile_options(-D${i}) + endforeach() + endfunction() +endif() + function(add_sources_from_current_dir target) - set(sources ${ARGN}) - list(TRANSFORM sources PREPEND ${CMAKE_CURRENT_SOURCE_DIR}/) + set(sources) + foreach(i ${ARGN}) + set(sources ${sources} ${CMAKE_CURRENT_SOURCE_DIR}/${i}) + endforeach() target_sources(${target} PRIVATE ${sources}) endfunction() diff --git a/crypto/CMakeLists.txt b/crypto/CMakeLists.txt index 7d11f444..c6420361 100644 --- a/crypto/CMakeLists.txt +++ b/crypto/CMakeLists.txt @@ -54,7 +54,9 @@ function(test_compile_with_flags outvar) endif() # See if we can compile the provided test program. - string(JOIN " " CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} ${flags}) + foreach(i ${flags}) + set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} ${i}") + endforeach() check_c_source_compiles("${OPT_TEST_SOURCE}" "${outvar}") if(${outvar} AND OPT_ADD_SOURCES_IF_SUCCESSFUL) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index eb273758..cc90fcdc 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.7) project(putty-documentation LANGUAGES) # This build script can be run standalone, or included as a diff --git a/unix/CMakeLists.txt b/unix/CMakeLists.txt index 37ea4337..a2332473 100644 --- a/unix/CMakeLists.txt +++ b/unix/CMakeLists.txt @@ -87,15 +87,15 @@ add_library(puttygen-common OBJECT ${CMAKE_SOURCE_DIR}/sshrand.c) add_executable(puttygen - ${CMAKE_SOURCE_DIR}/cmdgen.c) -target_link_libraries(puttygen - puttygen-common keygen console crypto utils) + ${CMAKE_SOURCE_DIR}/cmdgen.c + $) +target_link_libraries(puttygen keygen console crypto utils) installed_program(puttygen) add_executable(cgtest - ${CMAKE_SOURCE_DIR}/cgtest.c) -target_link_libraries(cgtest - puttygen-common keygen console crypto utils) + ${CMAKE_SOURCE_DIR}/cgtest.c + $) +target_link_libraries(cgtest keygen console crypto utils) add_executable(testsc ${CMAKE_SOURCE_DIR}/testsc.c)