diff options
49 files changed, 979 insertions, 474 deletions
diff --git a/Modules/CMakeBackwardCompatibilityCXX.cmake b/Modules/CMakeBackwardCompatibilityCXX.cmake index c6eead1ed3..29dabc60e6 100644 --- a/Modules/CMakeBackwardCompatibilityCXX.cmake +++ b/Modules/CMakeBackwardCompatibilityCXX.cmake @@ -34,10 +34,7 @@ IF(NOT CMAKE_SKIP_COMPATIBILITY_TESTS) INCLUDE(CheckIncludeFileCXX) INCLUDE(TestForSTDNamespace) INCLUDE(TestForANSIForScope) - CHECK_INCLUDE_FILE_CXX("sstream" CMAKE_HAS_ANSI_STRING_STREAM) + INCLUDE(TestForSSTREAM) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS_SAVE}") - IF(NOT CMAKE_HAS_ANSI_STRING_STREAM) - SET( CMAKE_NO_ANSI_STRING_STREAM 1 CACHE INTERNAL - "Does the compiler support sstream or stringstream.") - ENDIF(NOT CMAKE_HAS_ANSI_STRING_STREAM) ENDIF(NOT CMAKE_SKIP_COMPATIBILITY_TESTS) + diff --git a/Modules/CMakeFindWMake.cmake b/Modules/CMakeFindWMake.cmake new file mode 100644 index 0000000000..4353d6515c --- /dev/null +++ b/Modules/CMakeFindWMake.cmake @@ -0,0 +1,3 @@ +SET (CMAKE_MAKE_PROGRAM "wmake" CACHE STRING + "Program used to build from makefiles.") +MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) diff --git a/Modules/Platform/Windows-wcl386.cmake b/Modules/Platform/Windows-wcl386.cmake new file mode 100644 index 0000000000..fb81be5b6e --- /dev/null +++ b/Modules/Platform/Windows-wcl386.cmake @@ -0,0 +1,56 @@ +SET(CMAKE_LIBRARY_PATH_FLAG "libpath ") +SET(CMAKE_LINK_LIBRARY_FLAG "library ") + +IF(CMAKE_VERBOSE_MAKEFILE) + SET(CMAKE_WCL_QUIET) + SET(CMAKE_WLINK_QUIET) + SET(CMAKE_LIB_QUIET) +ELSE(CMAKE_VERBOSE_MAKEFILE) + SET(CMAKE_WCL_QUIET "-zq") + SET(CMAKE_WLINK_QUIET "option quiet") + SET(CMAKE_LIB_QUIET "-q") +ENDIF(CMAKE_VERBOSE_MAKEFILE) + +SET(CMAKE_BUILD_TYPE_INIT Debug) +SET (CMAKE_CXX_FLAGS_INIT "-w=3 -xs") +SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-br -bm -d2") +SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-br -bm -os -dNDEBUG") +SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-br -bm -ot -dNDEBUG") +SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-br -bm -d2 -ot -dNDEBUG") +SET (CMAKE_C_FLAGS_INIT "-w=3 ") +SET (CMAKE_C_FLAGS_DEBUG_INIT "-br -bm -od") +SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "-br -bm -os -dNDEBUG") +SET (CMAKE_C_FLAGS_RELEASE_INIT "-br -bm -ot -dNDEBUG") +SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-br -bm -ot -dNDEBUG") +SET (CMAKE_STANDARD_LIBRARIES "library clbrdll.lib library plbrdll.lib library kernel32.lib library user32.lib library gdi32.lib library winspool.lib library comdlg32.lib library advapi32.lib library shell32.lib library ole32.lib library oleaut32.lib library uuid.lib library odbc32.lib library odbccp32.lib" CACHE STRING + "Libraries linked by defalut with all applications.") + +SET(CMAKE_C_LINK_EXECUTABLE + "wlink ${CMAKE_START_TEMP_FILE} ${CMAKE_WLINK_QUIET} name <TARGET> option caseexact file {<OBJECTS>} <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") + +SET(CMAKE_CXX_LINK_EXECUTABLE ${CMAKE_C_LINK_EXECUTABLE}) + +# compile a C++ file into an object file +SET(CMAKE_CXX_COMPILE_OBJECT + "<CMAKE_CXX_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -dWIN32 -fo<OBJECT> -c -cc++ <SOURCE>${CMAKE_END_TEMP_FILE}") + +# compile a C file into an object file +SET(CMAKE_C_COMPILE_OBJECT + "<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_WCL_QUIET} <FLAGS> -dWIN32 -fo<OBJECT> -c -cc <SOURCE>${CMAKE_END_TEMP_FILE}") + +SET(CMAKE_CXX_CREATE_SHARED_LIBRARY + "wlink ${CMAKE_START_TEMP_FILE} system nt_dll ${CMAKE_WLINK_QUIET} name <TARGET> option caseexact file {<OBJECTS>} <LINK_LIBRARIES>" + "wlib -q -n -b <TARGET_BASE>.lib +<TARGET_BASE>.dll ${CMAKE_END_TEMP_FILE}") +SET(CMAKE_CXX_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_LIBRARY}) + +# create a C shared library +SET(CMAKE_C_CREATE_SHARED_LIBRARY ${CMAKE_CXX_CREATE_SHARED_LIBRARY}) + +# create a C shared module just copy the shared library rule +SET(CMAKE_C_CREATE_SHARED_MODULE ${CMAKE_C_CREATE_SHARED_LIBRARY}) + +# create a C++ static library +SET(CMAKE_CXX_CREATE_STATIC_LIBRARY "wlib ${CMAKE_LIB_QUIET} -n -b <TARGET> <OBJECTS> ") + +# create a C static library +SET(CMAKE_C_CREATE_STATIC_LIBRARY ${CMAKE_CXX_CREATE_STATIC_LIBRARY}) diff --git a/Modules/TestForSSTREAM.cmake b/Modules/TestForSSTREAM.cmake new file mode 100644 index 0000000000..f0d12d9f5b --- /dev/null +++ b/Modules/TestForSSTREAM.cmake @@ -0,0 +1,29 @@ +# # - Test for std:: namespace support +# check if the compiler supports std:: on stl classes +# CMAKE_NO_STD_NAMESPACE - defined by the results +# +IF("CMAKE_HAS_ANSI_STRING_STREAM" MATCHES "^CMAKE_HAS_ANSI_STRING_STREAM$") + MESSAGE(STATUS "Check for sstream") + TRY_COMPILE(CMAKE_HAS_ANSI_STRING_STREAM ${CMAKE_BINARY_DIR} + ${CMAKE_ROOT}/Modules/TestForSSTREAM.cxx + OUTPUT_VARIABLE OUTPUT) + IF (CMAKE_HAS_ANSI_STRING_STREAM) + MESSAGE(STATUS "Check for sstream - found") + SET (CMAKE_NO_ANSI_STRING_STREAM 0 CACHE INTERNAL + "Does the compiler support sstream") + FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log + "Determining if the CXX compiler has sstream passed with " + "the following output:\n${OUTPUT}\n\n") + ELSE (CMAKE_HAS_ANSI_STRING_STREAM) + MESSAGE(STATUS "Check for sstream - not found") + SET (CMAKE_NO_ANSI_STRING_STREAM 1 CACHE INTERNAL + "Does the compiler support sstream") + FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log + "Determining if the CXX compiler has sstream failed with " + "the following output:\n${OUTPUT}\n\n") + ENDIF (CMAKE_HAS_ANSI_STRING_STREAM) +ENDIF("CMAKE_HAS_ANSI_STRING_STREAM" MATCHES "^CMAKE_HAS_ANSI_STRING_STREAM$") + + + + diff --git a/Modules/TestForSSTREAM.cxx b/Modules/TestForSSTREAM.cxx new file mode 100644 index 0000000000..af4a4bbef9 --- /dev/null +++ b/Modules/TestForSSTREAM.cxx @@ -0,0 +1,11 @@ +#include <sstream> +int main(int, char*[]) +{ + std::ostringstream os; + os << "12345"; + if(os.str().size() == 5) + { + return 0; + } + return -1; +} diff --git a/Modules/readme.txt b/Modules/readme.txt index 1d336ac0f7..5ca0628a3e 100644 --- a/Modules/readme.txt +++ b/Modules/readme.txt @@ -28,7 +28,7 @@ If you need other commands to do special things then it should still begin with You really should also provide backwards compatibility any old settings that were actually in use. Make sure you comment them as deprecated, so that no-one starts using them. -To correctly docuement a module, create a comment block at the top with # comments. There are three types of comments that can be in the block: +To correctly document a module, create a comment block at the top with # comments. There are three types of comments that can be in the block: 1. The brief description of the module, this is done by: # - a small description diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 8fdf3f3ad2..52cf699737 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -175,6 +175,7 @@ IF (WIN32) SET(SRCS ${SRCS} cmGlobalBorlandMakefileGenerator.cxx cmGlobalNMakeMakefileGenerator.cxx + cmGlobalWatcomWMakeGenerator.cxx cmGlobalMSYSMakefileGenerator.cxx cmGlobalMinGWMakefileGenerator.cxx cmGlobalVisualStudio6Generator.cxx @@ -316,6 +317,15 @@ IF (NOT DART_ROOT) ENDIF (NOT DART_ROOT) IF(BUILD_TESTING) + SET(CMAKE_TEST_GENERATOR "" CACHE STRING "Generator used when running tests") + SET(CMAKE_TEST_MAKEPROGRAM "" CACHE FILEPATH "Generator used when running tests") + IF(NOT CMAKE_TEST_GENERATOR) + SET(CMAKE_TEST_GENERATOR "${CMAKE_GENERATOR}") + SET(CMAKE_TEST_MAKEPROGRAM "${MAKEPROGRAM}") + ELSE(NOT CMAKE_TEST_GENERATOR) + SET(CMAKE_TEST_DIFFERENT_GENERATOR TRUE) + ENDIF(NOT CMAKE_TEST_GENERATOR) + # This variable is set by cmake, however to # test cmake we want to make sure that # the ctest from this cmake is used for testing @@ -332,8 +342,8 @@ IF(BUILD_TESTING) "${CMake_SOURCE_DIR}/Tests/CommandLineTest" "${CMake_BINARY_DIR}/Tests/CommandLineTest" --build-two-config - --build-generator ${CMAKE_GENERATOR} - --build-makeprogram ${MAKEPROGRAM} + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-project CommandLineTest --test-command CommandLineTest) @@ -342,8 +352,8 @@ IF(BUILD_TESTING) "${CMake_SOURCE_DIR}/Tests/TarTest" "${CMake_BINARY_DIR}/Tests/TarTest" --build-two-config - --build-generator ${CMAKE_GENERATOR} - --build-makeprogram ${MAKEPROGRAM} + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-project TestTar --test-command TestTarExec) @@ -352,9 +362,9 @@ IF(BUILD_TESTING) "${CMake_SOURCE_DIR}/Tests/CustomCommand" "${CMake_BINARY_DIR}/Tests/CustomCommand" --build-two-config - --build-generator ${CMAKE_GENERATOR} + --build-generator ${CMAKE_TEST_GENERATOR} --build-project CustomCommand - --build-makeprogram ${MAKEPROGRAM} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-exe-dir "${CMake_BINARY_DIR}/Tests/CustomCommand/bin" --test-command CustomCommand ) @@ -364,9 +374,9 @@ IF(BUILD_TESTING) "${CMake_SOURCE_DIR}/Tests/FindPackageTest" "${CMake_BINARY_DIR}/Tests/FindPackageTest" --build-two-config - --build-generator ${CMAKE_GENERATOR} + --build-generator ${CMAKE_TEST_GENERATOR} --build-project FindPackageTest - --build-makeprogram ${MAKEPROGRAM} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --test-command FindPackageTest) ADD_TEST(SystemInformation ${CMAKE_CTEST_COMMAND} @@ -374,9 +384,9 @@ IF(BUILD_TESTING) "${CMake_SOURCE_DIR}/Tests/SystemInformation" "${CMake_BINARY_DIR}/Tests/SystemInformation" --build-two-config - --build-generator ${CMAKE_GENERATOR} + --build-generator ${CMAKE_TEST_GENERATOR} --build-project DumpInformation - --build-makeprogram ${MAKEPROGRAM} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --test-command DumpInformation) ADD_TEST(StringFileTest ${CMAKE_CTEST_COMMAND} @@ -384,9 +394,9 @@ IF(BUILD_TESTING) "${CMake_SOURCE_DIR}/Tests/StringFileTest" "${CMake_BINARY_DIR}/Tests/StringFileTest" --build-two-config - --build-generator ${CMAKE_GENERATOR} + --build-generator ${CMAKE_TEST_GENERATOR} --build-project StringFileTest - --build-makeprogram ${MAKEPROGRAM} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --test-command StringFileTest) ADD_TEST(MathTest ${CMAKE_CTEST_COMMAND} @@ -394,18 +404,18 @@ IF(BUILD_TESTING) "${CMake_SOURCE_DIR}/Tests/MathTest" "${CMake_BINARY_DIR}/Tests/MathTest" --build-two-config - --build-generator ${CMAKE_GENERATOR} + --build-generator ${CMAKE_TEST_GENERATOR} --build-project MathTest - --build-makeprogram ${MAKEPROGRAM} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --test-command MathTestExec) ADD_TEST(TryCompile ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/TryCompile" "${CMake_BINARY_DIR}/Tests/TryCompile" - --build-generator ${CMAKE_GENERATOR} + --build-generator ${CMAKE_TEST_GENERATOR} --build-project TryCompile - --build-makeprogram ${MAKEPROGRAM} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-two-config --test-command TryCompile) @@ -413,9 +423,9 @@ IF(BUILD_TESTING) --build-and-test "${CMake_SOURCE_DIR}/Tests/Simple" "${CMake_BINARY_DIR}/Tests/Simple" - --build-generator ${CMAKE_GENERATOR} + --build-generator ${CMAKE_TEST_GENERATOR} --build-project Simple - --build-makeprogram ${MAKEPROGRAM} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-two-config --test-command simple) @@ -423,9 +433,9 @@ IF(BUILD_TESTING) # --build-and-test # "${CMake_SOURCE_DIR}/Tests/SameName" # "${CMake_BINARY_DIR}/Tests/SameName" -# --build-generator ${CMAKE_GENERATOR} +# --build-generator ${CMAKE_TEST_GENERATOR} # --build-project SameName -# --build-makeprogram ${MAKEPROGRAM} +# --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} # --build-two-config # --test-command # "${CMake_BINARY_DIR}/Tests/SameName/Exe1/mytest2") @@ -434,9 +444,9 @@ IF(BUILD_TESTING) --build-and-test "${CMake_SOURCE_DIR}/Tests/OutOfSource" "${CMake_BINARY_DIR}/Tests/OutOfSource" - --build-generator ${CMAKE_GENERATOR} + --build-generator ${CMAKE_TEST_GENERATOR} --build-project OutOfSource - --build-makeprogram ${MAKEPROGRAM} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-two-config --test-command "${CMake_BINARY_DIR}/Tests/OutOfSource/SubDir/OutOfSourceSubdir/simple") @@ -445,9 +455,9 @@ IF(BUILD_TESTING) --build-and-test "${CMake_SOURCE_DIR}/Tests/PreOrder" "${CMake_BINARY_DIR}/Tests/PreOrder" - --build-generator ${CMAKE_GENERATOR} + --build-generator ${CMAKE_TEST_GENERATOR} --build-project PreOrder - --build-makeprogram ${MAKEPROGRAM} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-two-config --test-command simple) @@ -455,9 +465,9 @@ IF(BUILD_TESTING) --build-and-test "${CMake_SOURCE_DIR}/Tests/COnly" "${CMake_BINARY_DIR}/Tests/COnly" - --build-generator ${CMAKE_GENERATOR} + --build-generator ${CMAKE_TEST_GENERATOR} --build-project conly - --build-makeprogram ${MAKEPROGRAM} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-two-config --test-command conly) @@ -465,9 +475,9 @@ IF(BUILD_TESTING) --build-and-test "${CMake_SOURCE_DIR}/Tests/MacroTest" "${CMake_BINARY_DIR}/Tests/MacroTest" - --build-generator ${CMAKE_GENERATOR} + --build-generator ${CMAKE_TEST_GENERATOR} --build-project littleMacroTest - --build-makeprogram ${MAKEPROGRAM} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-two-config --test-command miniMacroTest) @@ -477,9 +487,9 @@ IF(BUILD_TESTING) --build-and-test "${CMake_SOURCE_DIR}/Tests/SimpleInstall" "${CMake_BINARY_DIR}/Tests/SimpleInstall" - --build-generator ${CMAKE_GENERATOR} + --build-generator ${CMAKE_TEST_GENERATOR} --build-project TestSimpleInstall - --build-makeprogram ${MAKEPROGRAM} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-two-config --build-options "-DCMAKE_INSTALL_PREFIX:PATH=${SimpleInstallInstallDir}" @@ -488,9 +498,9 @@ IF(BUILD_TESTING) --build-and-test "${CMake_SOURCE_DIR}/Tests/SimpleInstallS2" "${CMake_BINARY_DIR}/Tests/SimpleInstallS2" - --build-generator ${CMAKE_GENERATOR} + --build-generator ${CMAKE_TEST_GENERATOR} --build-project TestSimpleInstall - --build-makeprogram ${MAKEPROGRAM} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-two-config --build-options "-DCMAKE_INSTALL_PREFIX:PATH=${SimpleInstallInstallDir}" @@ -501,9 +511,9 @@ IF(BUILD_TESTING) --build-and-test "${CMake_SOURCE_DIR}/Tests/X11" "${CMake_BINARY_DIR}/Tests/X11" - --build-generator ${CMAKE_GENERATOR} + --build-generator ${CMAKE_TEST_GENERATOR} --build-project UseX11 - --build-makeprogram ${MAKEPROGRAM} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-two-config --test-command UseX11) @@ -511,9 +521,9 @@ IF(BUILD_TESTING) --build-and-test "${CMake_SOURCE_DIR}/Tests/LoadCommand" "${CMake_BINARY_DIR}/Tests/LoadCommand" - --build-generator ${CMAKE_GENERATOR} + --build-generator ${CMAKE_TEST_GENERATOR} --build-project LoadedCommand - --build-makeprogram ${MAKEPROGRAM} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-two-config --test-command LoadedCommand) @@ -521,9 +531,9 @@ IF(BUILD_TESTING) --build-and-test "${CMake_SOURCE_DIR}/Tests/LoadCommandOneConfig" "${CMake_BINARY_DIR}/Tests/LoadCommandOneConfig" - --build-generator ${CMAKE_GENERATOR} + --build-generator ${CMAKE_TEST_GENERATOR} --build-project LoadedCommand - --build-makeprogram ${MAKEPROGRAM} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --test-command LoadedCommand ) @@ -538,10 +548,12 @@ IF(BUILD_TESTING) "${CMake_SOURCE_DIR}/Tests/Complex" "${CMake_BINARY_DIR}/Tests/Complex" --build-two-config - --build-generator ${CMAKE_GENERATOR} + --build-generator ${CMAKE_TEST_GENERATOR} --build-project complex - --build-makeprogram ${MAKEPROGRAM} - --build-exe-dir "${CMake_BINARY_DIR}/Tests/Complex/bin" + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + --build-exe-dir "${CMake_BINARY_DIR}/Tests/Complex/bin" + --build-options + -DCMAKE_TEST_DIFFERENT_GENERATOR:BOOL=${CMAKE_TEST_DIFFERENT_GENERATOR} --test-command complex ) @@ -549,9 +561,9 @@ IF(BUILD_TESTING) --build-and-test "${CMake_SOURCE_DIR}/Tests/ComplexOneConfig" "${CMake_BINARY_DIR}/Tests/ComplexOneConfig" - --build-generator ${CMAKE_GENERATOR} + --build-generator ${CMAKE_TEST_GENERATOR} --build-project complex - --build-makeprogram ${MAKEPROGRAM} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-exe-dir "${CMake_BINARY_DIR}/Tests/ComplexOneConfig/bin" --test-command complex) @@ -559,9 +571,9 @@ IF(BUILD_TESTING) # --build-and-test # "${CMake_SOURCE_DIR}/Tests/ComplexRelativePaths" # "${CMake_BINARY_DIR}/Tests/ComplexRelativePaths" -# --build-generator ${CMAKE_GENERATOR} +# --build-generator ${CMAKE_TEST_GENERATOR} # --build-project complex -# --build-makeprogram ${MAKEPROGRAM} +# --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} # --build-exe-dir "${CMake_BINARY_DIR}/Tests/ComplexRelativePaths/bin" # --build-options -DCMAKE_USE_RELATIVE_PATHS:BOOL=ON # --test-command complex) @@ -572,9 +584,9 @@ IF(BUILD_TESTING) --build-and-test "${CMake_SOURCE_DIR}/Example" "${CMake_BINARY_DIR}/Example" - --build-generator ${CMAKE_GENERATOR} + --build-generator ${CMAKE_TEST_GENERATOR} --build-project HELLO - --build-makeprogram ${MAKEPROGRAM} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-exe-dir "${CMake_BINARY_DIR}/Example/Demo" --test-command helloDemo ) @@ -584,8 +596,8 @@ IF(BUILD_TESTING) "${CMake_SOURCE_DIR}/Tests/Tutorial/Step1" "${CMake_BINARY_DIR}/Tests/Tutorial/Step1" --build-two-config - --build-generator ${CMAKE_GENERATOR} - --build-makeprogram ${MAKEPROGRAM} + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-project Tutorial --test-command Tutorial 25.0) @@ -594,8 +606,8 @@ IF(BUILD_TESTING) "${CMake_SOURCE_DIR}/Tests/Tutorial/Step2" "${CMake_BINARY_DIR}/Tests/Tutorial/Step2" --build-two-config - --build-generator ${CMAKE_GENERATOR} - --build-makeprogram ${MAKEPROGRAM} + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-project Tutorial --test-command Tutorial 25.0) @@ -604,8 +616,8 @@ IF(BUILD_TESTING) "${CMake_SOURCE_DIR}/Tests/Tutorial/Step3" "${CMake_BINARY_DIR}/Tests/Tutorial/Step3" --build-two-config - --build-generator ${CMAKE_GENERATOR} - --build-makeprogram ${MAKEPROGRAM} + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-project Tutorial --test-command Tutorial 25.0) @@ -614,8 +626,8 @@ IF(BUILD_TESTING) "${CMake_SOURCE_DIR}/Tests/Tutorial/Step4" "${CMake_BINARY_DIR}/Tests/Tutorial/Step4" --build-two-config - --build-generator ${CMAKE_GENERATOR} - --build-makeprogram ${MAKEPROGRAM} + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-project Tutorial --test-command Tutorial 25.0) @@ -624,8 +636,8 @@ IF(BUILD_TESTING) "${CMake_SOURCE_DIR}/Tests/Tutorial/Step5" "${CMake_BINARY_DIR}/Tests/Tutorial/Step5" --build-two-config - --build-generator ${CMAKE_GENERATOR} - --build-makeprogram ${MAKEPROGRAM} + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-project Tutorial --test-command Tutorial 25.0) @@ -633,9 +645,9 @@ IF(BUILD_TESTING) --build-and-test "${CMake_SOURCE_DIR}/Tests/Testing" "${CMake_BINARY_DIR}/Tests/Testing" - --build-generator ${CMAKE_GENERATOR} + --build-generator ${CMAKE_TEST_GENERATOR} --build-project testing - --build-makeprogram ${MAKEPROGRAM} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-exe-dir "${CMake_BINARY_DIR}/Tests/Testing/bin" --test-command testing ) @@ -644,9 +656,9 @@ IF(BUILD_TESTING) --build-and-test "${CMake_SOURCE_DIR}/Tests/Wrapping" "${CMake_BINARY_DIR}/Tests/Wrapping" - --build-generator ${CMAKE_GENERATOR} + --build-generator ${CMAKE_TEST_GENERATOR} --build-project wrapping - --build-makeprogram ${MAKEPROGRAM} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin" --test-command wrapping ) @@ -663,9 +675,9 @@ IF(BUILD_TESTING) --build-and-test "${CMake_SOURCE_DIR}/Tests/Wrapping" "${CMake_BINARY_DIR}/Tests/Wrapping" - --build-generator ${CMAKE_GENERATOR} + --build-generator ${CMAKE_TEST_GENERATOR} --build-project Wrapping - --build-makeprogram ${MAKEPROGRAM} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin" --test-command qtwrapping ) @@ -675,8 +687,8 @@ IF(BUILD_TESTING) --build-and-test "${CMake_SOURCE_DIR}/Tests/TestDriver" "${CMake_BINARY_DIR}/Tests/TestDriver" - --build-generator ${CMAKE_GENERATOR} - --build-makeprogram ${MAKEPROGRAM} + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin" --build-project TestDriverTest --test-command TestDriverTest test1 @@ -686,8 +698,8 @@ IF(BUILD_TESTING) --build-and-test "${CMake_SOURCE_DIR}/Tests/TestDriver" "${CMake_BINARY_DIR}/Tests/TestDriver" - --build-generator ${CMAKE_GENERATOR} - --build-makeprogram ${MAKEPROGRAM} + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin" --build-project TestDriverTest --test-command TestDriverTest test2 @@ -697,8 +709,8 @@ IF(BUILD_TESTING) --build-and-test "${CMake_SOURCE_DIR}/Tests/TestDriver" "${CMake_BINARY_DIR}/Tests/TestDriver" - --build-generator ${CMAKE_GENERATOR} - --build-makeprogram ${MAKEPROGRAM} + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-exe-dir "${CMake_BINARY_DIR}/Tests/Wrapping/bin" --build-project TestDriverTest --test-command TestDriverTest subdir/test3 @@ -710,8 +722,8 @@ IF(BUILD_TESTING) "${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut" --build-exe-dir "${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Exec" --build-project Dependency - --build-generator ${CMAKE_GENERATOR} - --build-makeprogram ${MAKEPROGRAM} + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-options -DLIBRARY_OUTPUT_PATH:PATH=${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Lib --test-command exec @@ -723,8 +735,8 @@ IF(BUILD_TESTING) "${CMake_SOURCE_DIR}/Tests/Dependency" "${CMake_BINARY_DIR}/Tests/Dependency/WOLibOut" --build-exe-dir "${CMake_BINARY_DIR}/Tests/Dependency/WOLibOut/Exec" - --build-generator ${CMAKE_GENERATOR} - --build-makeprogram ${MAKEPROGRAM} + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-project Dependency --test-command exec ) @@ -734,8 +746,8 @@ IF(BUILD_TESTING) "${CMake_SOURCE_DIR}/Tests/Dependency" "${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut" --build-exe-dir "${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Exec2" - --build-generator ${CMAKE_GENERATOR} - --build-makeprogram ${MAKEPROGRAM} + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-project Dependency --build-options -DLIBRARY_OUTPUT_PATH:PATH=${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Lib @@ -747,8 +759,8 @@ IF(BUILD_TESTING) "${CMake_SOURCE_DIR}/Tests/Dependency" "${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut" --build-exe-dir "${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Exec3" - --build-generator ${CMAKE_GENERATOR} - --build-makeprogram ${MAKEPROGRAM} + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-project Dependency --build-options -DLIBRARY_OUTPUT_PATH:PATH=${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Lib @@ -759,8 +771,8 @@ IF(BUILD_TESTING) "${CMake_SOURCE_DIR}/Tests/Dependency" "${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut" --build-exe-dir "${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Exec4" - --build-generator ${CMAKE_GENERATOR} - --build-makeprogram ${MAKEPROGRAM} + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-project Dependency --build-options -DLIBRARY_OUTPUT_PATH:PATH=${CMake_BINARY_DIR}/Tests/Dependency/WithLibOut/Lib @@ -773,8 +785,8 @@ IF(BUILD_TESTING) "${CMake_BINARY_DIR}/Tests/Jump/WithLibOut" --build-exe-dir "${CMake_BINARY_DIR}/Tests/Jump/WithLibOut/Executable" --build-project Jump - --build-generator ${CMAKE_GENERATOR} - --build-makeprogram ${MAKEPROGRAM} + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-options -DLIBRARY_OUTPUT_PATH:PATH=${CMake_BINARY_DIR}/Tests/Jump/WithLibOut/Lib --test-command jumpExecutable @@ -787,8 +799,8 @@ IF(BUILD_TESTING) --build-exe-dir "${CMake_BINARY_DIR}/Tests/Jump/NoLibOut/Executable" --build-run-dir "${CMake_BINARY_DIR}/Tests/Jump/NoLibOut/Executable" --build-project Jump - --build-generator ${CMAKE_GENERATOR} - --build-makeprogram ${MAKEPROGRAM} + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --test-command jumpExecutable ) @@ -797,8 +809,8 @@ IF(BUILD_TESTING) "${CMake_SOURCE_DIR}/Tests/LinkLine" "${CMake_BINARY_DIR}/Tests/LinkLine" --build-exe-dir "${CMake_BINARY_DIR}/Tests/LinkLine" - --build-generator ${CMAKE_GENERATOR} - --build-makeprogram ${MAKEPROGRAM} + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-project Linkline --test-command Exec ) @@ -807,8 +819,8 @@ IF(BUILD_TESTING) --build-and-test "${CMake_SOURCE_DIR}/Tests/LinkLineOrder" "${CMake_BINARY_DIR}/Tests/LinkLineOrder" - --build-generator ${CMAKE_GENERATOR} - --build-makeprogram ${MAKEPROGRAM} + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-exe-dir "${CMake_BINARY_DIR}/Tests/LinkLineOrder" --build-project LinkLineOrder --test-command Exec1 @@ -819,8 +831,8 @@ IF(BUILD_TESTING) "${CMake_SOURCE_DIR}/Tests/LinkLineOrder" "${CMake_BINARY_DIR}/Tests/LinkLineOrder" --build-exe-dir "${CMake_BINARY_DIR}/Tests/LinkLineOrder" - --build-generator ${CMAKE_GENERATOR} - --build-makeprogram ${MAKEPROGRAM} + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-project LinkLineOrder --test-command Exec2 ) @@ -829,23 +841,26 @@ IF(BUILD_TESTING) --build-and-test "${CMake_SOURCE_DIR}/Tests/ExternalOBJ" "${CMake_BINARY_DIR}/Tests/ExternalOBJ" - --build-generator ${CMAKE_GENERATOR} + --build-generator ${CMAKE_TEST_GENERATOR} --build-project ExternalOBJ - --build-makeprogram ${MAKEPROGRAM} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-exe-dir "${CMake_BINARY_DIR}/ExternalOBJ" --test-command executable ) - ADD_TEST(kwsys ${CMAKE_CTEST_COMMAND} - --build-and-test - "${CMake_SOURCE_DIR}/Source/kwsys" - "${CMake_BINARY_DIR}/Tests/kwsys" - --build-exe-dir "${CMake_BINARY_DIR}/Tests/kwsys" - --build-generator ${CMAKE_GENERATOR} - --build-makeprogram ${MAKEPROGRAM} - --build-project kwsys - --test-command testIOS - ) + IF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) + ADD_TEST(kwsys ${CMAKE_CTEST_COMMAND} + --build-and-test + "${CMake_SOURCE_DIR}/Source/kwsys" + "${CMake_BINARY_DIR}/Tests/kwsys" + --build-exe-dir "${CMake_BINARY_DIR}/Tests/kwsys" + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} + --build-project kwsys + --test-command testIOS + ) + ENDIF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) + IF (WIN32) ADD_TEST(SubDir ${CMAKE_CTEST_COMMAND} @@ -853,8 +868,8 @@ IF(BUILD_TESTING) "${CMake_SOURCE_DIR}/Tests/SubDir" "${CMake_BINARY_DIR}/Tests/SubDir" --build-exe-dir "${CMake_BINARY_DIR}/Tests/SubDir/Executable" - --build-generator ${CMAKE_GENERATOR} - --build-makeprogram ${MAKEPROGRAM} + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-project SUBDIR --test-command test "${CMake_BINARY_DIR}/Tests/SubDir/ShouldBeHere" @@ -866,8 +881,8 @@ IF(BUILD_TESTING) "${CMake_SOURCE_DIR}/Tests/SubDir" "${CMake_BINARY_DIR}/Tests/SubDir" --build-exe-dir "${CMake_BINARY_DIR}/Tests/SubDir/Executable" - --build-generator ${CMAKE_GENERATOR} - --build-makeprogram ${MAKEPROGRAM} + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-project SUBDIR --test-command test "${CMake_BINARY_DIR}/Tests/SubDir/ShouldBeHere" @@ -875,30 +890,30 @@ IF(BUILD_TESTING) ) ENDIF (WIN32) - IF("${CMAKE_GENERATOR}" MATCHES "Makefile") + IF("${CMAKE_TEST_GENERATOR}" MATCHES "Makefile") ADD_TEST(MakeClean ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/MakeClean" "${CMake_BINARY_DIR}/Tests/MakeClean" - --build-generator ${CMAKE_GENERATOR} + --build-generator ${CMAKE_TEST_GENERATOR} --build-project MakeClean - --build-makeprogram ${MAKEPROGRAM} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-exe-dir "${CMake_BINARY_DIR}/MakeClean" --test-command check_clean ) - ENDIF("${CMAKE_GENERATOR}" MATCHES "Makefile") + ENDIF("${CMAKE_TEST_GENERATOR}" MATCHES "Makefile") - IF(${CMAKE_GENERATOR} MATCHES "Visual Studio") + IF(${CMAKE_TEST_GENERATOR} MATCHES "Visual Studio") ADD_TEST(VSExternalInclude ${CMAKE_CTEST_COMMAND} --build-and-test "${CMake_SOURCE_DIR}/Tests/VSExternalInclude" "${CMake_BINARY_DIR}/Tests/VSExternalInclude" --build-two-config - --build-generator ${CMAKE_GENERATOR} + --build-generator ${CMAKE_TEST_GENERATOR} --build-project VSExternalInclude - --build-makeprogram ${MAKEPROGRAM} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --test-command VSExternalInclude) - ENDIF(${CMAKE_GENERATOR} MATCHES "Visual Studio") + ENDIF(${CMAKE_TEST_GENERATOR} MATCHES "Visual Studio") IF (APPLE AND CMAKE_COMPILER_IS_GNUCXX) ADD_TEST(BundleTest ${CMAKE_CTEST_COMMAND} @@ -906,8 +921,8 @@ IF(BUILD_TESTING) "${CMake_SOURCE_DIR}/Tests/BundleTest" "${CMake_BINARY_DIR}/Tests/BundleTest" --build-two-config - --build-generator ${CMAKE_GENERATOR} - --build-makeprogram ${MAKEPROGRAM} + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-project BundleTest --test-command BundleTest.app/Contents/MacOS/BundleTest) @@ -915,8 +930,8 @@ IF(BUILD_TESTING) --build-and-test "${CMake_SOURCE_DIR}/Tests/ObjC++" "${CMake_BINARY_DIR}/Tests/ObjC++" - --build-generator ${CMAKE_GENERATOR} - --build-makeprogram ${MAKEPROGRAM} + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-project objc++ --test-command objc++ ) @@ -943,9 +958,9 @@ IF(BUILD_TESTING) ) ENDIF (CTEST_TEST_CTEST AND CMAKE_RUN_LONG_TESTS) - IF("${CMAKE_GENERATOR}" MATCHES Xcode) + IF("${CMAKE_TEST_GENERATOR}" MATCHES Xcode) SET(CMAKE_SKIP_BOOTSTRAP_TEST 1) - ENDIF("${CMAKE_GENERATOR}" MATCHES Xcode) + ENDIF("${CMAKE_TEST_GENERATOR}" MATCHES Xcode) IF(EXISTS "${CMAKE_BINARY_DIR}/CMakeLists.txt") # If there is CMakeLists.txt in the binary tree, assume in-source build SET(CMAKE_SKIP_BOOTSTRAP_TEST 1) @@ -958,11 +973,11 @@ IF(BUILD_TESTING) --build-nocmake --build-noclean --build-makeprogram ${CMake_SOURCE_DIR}/bootstrap - --build-generator "${CMAKE_GENERATOR}" + --build-generator "${CMAKE_TEST_GENERATOR}" --test-command ${CMake_BINARY_DIR}/Tests/BootstrapTest/Bootstrap.cmk/cmake) ENDIF(UNIX AND CMAKE_RUN_LONG_TESTS AND NOT CMAKE_SKIP_BOOTSTRAP_TEST) - IF(CMAKE_GENERATOR MATCHES "Makefiles") + IF(CMAKE_TEST_GENERATOR MATCHES "Makefiles") # see if we can find a fortran compiler on the machine # if so, add the fortran test and see if it works. SET(CMAKE_Fortran_COMPILER_LIST ifort ifc efc f95 pgf95 @@ -975,9 +990,9 @@ IF(BUILD_TESTING) --build-and-test "${CMake_SOURCE_DIR}/Tests/Fortran" "${CMake_BINARY_DIR}/Tests/Fortran" - --build-generator ${CMAKE_GENERATOR} + --build-generator ${CMAKE_TEST_GENERATOR} --build-project testf - --build-makeprogram ${MAKEPROGRAM} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-two-config --test-command testf) ENDIF(CMAKE_Fortran_COMPILER_FULLPATH) @@ -995,16 +1010,16 @@ IF(BUILD_TESTING) --build-and-test "${CMake_SOURCE_DIR}/Tests/Java" "${CMake_BINARY_DIR}/Tests/Java" - --build-generator ${CMAKE_GENERATOR} + --build-generator ${CMAKE_TEST_GENERATOR} --build-project hello - --build-makeprogram ${MAKEPROGRAM} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-two-config --build-run-dir "${CMake_BINARY_DIR}/Tests/Java/" --test-command ${JAVA_RUNTIME} -classpath hello.jar HelloWorld) ENDIF("${JNI_FILE}" MATCHES "JDK1_2") ENDIF(JNI_H) ENDIF(JAVA_COMPILE AND JAVA_RUNTIME AND JAVA_ARCHIVE AND NOT MINGW) - ENDIF(CMAKE_GENERATOR MATCHES "Makefiles") + ENDIF(CMAKE_TEST_GENERATOR MATCHES "Makefiles") IF (CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE OR WXWINDOWS_INCLUDE_DIR) # Will be set if the wxwindows gui is on @@ -1012,8 +1027,8 @@ IF(BUILD_TESTING) --build-and-test "${CMake_SOURCE_DIR}/Tests/UseWX" "${CMake_BINARY_DIR}/Tests/UseWX" - --build-generator ${CMAKE_GENERATOR} - --build-makeprogram ${MAKEPROGRAM} + --build-generator ${CMAKE_TEST_GENERATOR} + --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM} --build-exe-dir ${CMake_BINARY_DIR}/Tests/UseWX --build-project UsewxWindows --build-options -DCMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE:FILEPATH=${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} diff --git a/Source/cmCPluginAPI.cxx b/Source/cmCPluginAPI.cxx index b460318415..ba3786460b 100644 --- a/Source/cmCPluginAPI.cxx +++ b/Source/cmCPluginAPI.cxx @@ -27,17 +27,17 @@ extern "C" { -void *cmGetClientData(void *info) +void CCONV *cmGetClientData(void *info) { return ((cmLoadedCommandInfo *)info)->ClientData; } -void cmSetClientData(void *info, void *cd) +void CCONV cmSetClientData(void *info, void *cd) { ((cmLoadedCommandInfo *)info)->ClientData = cd; } -void cmSetError(void *info, const char *err) +void CCONV cmSetError(void *info, const char *err) { if (((cmLoadedCommandInfo *)info)->Error) { @@ -46,35 +46,35 @@ void cmSetError(void *info, const char *err) ((cmLoadedCommandInfo *)info)->Error = strdup(err); } -unsigned int cmGetCacheMajorVersion(void *arg) +unsigned int CCONV cmGetCacheMajorVersion(void *arg) { cmMakefile *mf = static_cast<cmMakefile *>(arg); return mf->GetCacheMajorVersion(); } -unsigned int cmGetCacheMinorVersion(void *arg) +unsigned int CCONV cmGetCacheMinorVersion(void *arg) { cmMakefile *mf = static_cast<cmMakefile *>(arg); return mf->GetCacheMinorVersion(); } -unsigned int cmGetMajorVersion(void *) +unsigned int CCONV cmGetMajorVersion(void *) { return cmMakefile::GetMajorVersion(); } -unsigned int cmGetMinorVersion(void *) +unsigned int CCONV cmGetMinorVersion(void *) { return cmMakefile::GetMinorVersion(); } -void cmAddDefinition(void *arg, const char* name, const char* value) +void CCONV cmAddDefinition(void *arg, const char* name, const char* value) { cmMakefile *mf = static_cast<cmMakefile *>(arg); mf->AddDefinition(name,value); } /* Add a definition to this makefile and the global cmake cache. */ -void cmAddCacheDefinition(void *arg, const char* name, const char* value, +void CCONV cmAddCacheDefinition(void *arg, const char* name, const char* value, const char* doc, int type) { @@ -109,75 +109,75 @@ void cmAddCacheDefinition(void *arg, const char* name, const char* value, } } -const char* cmGetProjectName(void *arg) +const char* CCONV cmGetProjectName(void *arg) { cmMakefile *mf = static_cast<cmMakefile *>(arg); return mf->GetProjectName(); } -const char* cmGetHomeDirectory(void *arg) +const char* CCONV cmGetHomeDirectory(void *arg) { cmMakefile *mf = static_cast<cmMakefile *>(arg); return mf->GetHomeDirectory(); } -const char* cmGetHomeOutputDirectory(void *arg) +const char* CCONV cmGetHomeOutputDirectory(void *arg) { cmMakefile *mf = static_cast<cmMakefile *>(arg); return mf->GetHomeOutputDirectory(); } -const char* cmGetStartDirectory(void *arg) +const char* CCONV cmGetStartDirectory(void *arg) { cmMakefile *mf = static_cast<cmMakefile *>(arg); return mf->GetStartDirectory(); } -const char* cmGetStartOutputDirectory(void *arg) +const char* CCONV cmGetStartOutputDirectory(void *arg) { cmMakefile *mf = static_cast<cmMakefile *>(arg); return mf->GetStartOutputDirectory(); } -const char* cmGetCurrentDirectory(void *arg) +const char* CCONV cmGetCurrentDirectory(void *arg) { cmMakefile *mf = static_cast<cmMakefile *>(arg); return mf->GetCurrentDirectory(); } -const char* cmGetCurrentOutputDirectory(void *arg) +const char* CCONV cmGetCurrentOutputDirectory(void *arg) { cmMakefile *mf = static_cast<cmMakefile *>(arg); return mf->GetCurrentOutputDirectory(); } -const char* cmGetDefinition(void *arg,const char*def) +const char* CCONV cmGetDefinition(void *arg,const char*def) { cmMakefile *mf = static_cast<cmMakefile *>(arg); return mf->GetDefinition(def); } -int cmIsOn(void *arg, const char* name) +int CCONV cmIsOn(void *arg, const char* name) { cmMakefile *mf = static_cast<cmMakefile *>(arg); return static_cast<int>(mf->IsOn(name)); } /** Check if a command exists. */ -int cmCommandExists(void *arg, const char* name) +int CCONV cmCommandExists(void *arg, const char* name) { cmMakefile *mf = static_cast<cmMakefile *>(arg); return static_cast<int>(mf->CommandExists(name)); } -void cmAddDefineFlag(void *arg, const char* definition) +void CCONV cmAddDefineFlag(void *arg, const char* definition) { cmMakefile *mf = static_cast<cmMakefile *>(arg); mf->AddDefineFlag(definition); } -void cmAddLinkDirectoryForTarget(void *arg, const char *tgt, const char* d) +void CCONV cmAddLinkDirectoryForTarget(void *arg, const char *tgt, const char* d) { cmMakefile *mf = static_cast<cmMakefile *>(arg); mf->AddLinkDirectoryForTarget(tgt,d); } -void cmAddExecutable(void *arg, const char *exename, +void CCONV cmAddExecutable(void *arg, const char *exename, int numSrcs, const char **srcs, int win32) { cmMakefile *mf = static_cast<cmMakefile *>(arg); @@ -194,7 +194,7 @@ void cmAddExecutable(void *arg, const char *exename, } } -void cmAddUtilityCommand(void *arg, const char* utilityName, +void CCONV cmAddUtilityCommand(void *arg, const char* utilityName, const char* command, const char* arguments, int all, @@ -242,7 +242,7 @@ void cmAddUtilityCommand(void *arg, const char* utilityName, mf->AddUtilityCommand(utilityName, (all ? true : false), output, depends2, commandLines); } -void cmAddCustomCommand(void *arg, const char* source, +void CCONV cmAddCustomCommand(void *arg, const char* source, const char* command, int numArgs, const char **args, int numDepends, const char **depends, @@ -287,7 +287,7 @@ void cmAddCustomCommand(void *arg, const char* source, commandLines, no_comment); } -void cmAddCustomCommandToOutput(void *arg, const char* output, +void CCONV cmAddCustomCommandToOutput(void *arg, const char* output, const char* command, int numArgs, const char **args, const char* main_dependency, @@ -323,7 +323,7 @@ void cmAddCustomCommandToOutput(void *arg, const char* output, commandLines, no_comment); } -void cmAddCustomCommandToTarget(void *arg, const char* target, +void CCONV cmAddCustomCommandToTarget(void *arg, const char* target, const char* command, int numArgs, const char **args, int commandType) @@ -366,7 +366,7 @@ void cmAddCustomCommandToTarget(void *arg, const char* target, cctype, no_comment); } -void cmAddLinkLibraryForTarget(void *arg, const char *tgt, const char*value, +void CCONV cmAddLinkLibraryForTarget(void *arg, const char *tgt, const char*value, int libtype) { cmMakefile *mf = static_cast<cmMakefile *>(arg); @@ -385,7 +385,7 @@ void cmAddLinkLibraryForTarget(void *arg, const char *tgt, const char*value, } } -void cmAddLibrary(void *arg, const char *libname, int shared, +void CCONV cmAddLibrary(void *arg, const char *libname, int shared, int numSrcs, const char **srcs) { cmMakefile *mf = static_cast<cmMakefile *>(arg); @@ -398,7 +398,7 @@ void cmAddLibrary(void *arg, const char *libname, int shared, mf->AddLibrary(libname, (shared ? true : false), srcs2); } -char *cmExpandVariablesInString(void *arg, const char *source, +char CCONV *cmExpandVariablesInString(void *arg, const char *source, int escapeQuotes, int atOnly) { cmMakefile *mf = static_cast<cmMakefile *>(arg); @@ -417,7 +417,7 @@ char *cmExpandVariablesInString(void *arg, const char *source, } -int cmExecuteCommand(void *arg, const char *name, +int CCONV cmExecuteCommand(void *arg, const char *name, int numArgs, const char **args) { cmMakefile *mf = static_cast<cmMakefile *>(arg); @@ -432,7 +432,7 @@ int cmExecuteCommand(void *arg, const char *name, return mf->ExecuteCommand(lff); } -void cmExpandSourceListArguments(void *arg, +void CCONV cmExpandSourceListArguments(void *arg, int numArgs, const char **args, int *resArgc, @@ -462,7 +462,7 @@ void cmExpandSourceListArguments(void *arg, *resArgv = resargv; } -void cmFreeArguments(int argc, char **argv) +void CCONV cmFreeArguments(int argc, char **argv) { int i; for (i = 0; i < argc; ++i) @@ -475,7 +475,7 @@ void cmFreeArguments(int argc, char **argv) } } -int cmGetTotalArgumentSize(int argc, char **argv) +int CCONV cmGetTotalArgumentSize(int argc, char **argv) { int i; int result = 0; @@ -489,13 +489,13 @@ int cmGetTotalArgumentSize(int argc, char **argv) return result; } -void *cmGetSource(void *arg, const char *name) +void CCONV *cmGetSource(void *arg, const char *name) { cmMakefile *mf = static_cast<cmMakefile *>(arg); return (void *)mf->GetSource(name); } -void * cmAddSource(void *arg, void *arg2) +void * CCONV cmAddSource(void *arg, void *arg2) { cmMakefile *mf = static_cast<cmMakefile *>(arg); cmSourceFile *sf = static_cast<cmSourceFile *>(arg2); @@ -503,54 +503,54 @@ void * cmAddSource(void *arg, void *arg2) } -void * cmCreateSourceFile() +void * CCONV cmCreateSourceFile() { return (void *)(new cmSourceFile); } -void cmDestroySourceFile(void *arg) +void CCONV cmDestroySourceFile(void *arg) { cmSourceFile *sf = static_cast<cmSourceFile *>(arg); delete sf; } -const char *cmSourceFileGetSourceName(void *arg) +const char * CCONV cmSourceFileGetSourceName(void *arg) { cmSourceFile *sf = static_cast<cmSourceFile *>(arg); return sf->GetSourceName().c_str(); } -const char *cmSourceFileGetFullPath(void *arg) +const char * CCONV cmSourceFileGetFullPath(void *arg) { cmSourceFile *sf = static_cast<cmSourceFile *>(arg); return sf->GetFullPath().c_str(); } -const char *cmSourceFileGetProperty(void *arg,const char *prop) +const char * CCONV cmSourceFileGetProperty(void *arg,const char *prop) { cmSourceFile *sf = static_cast<cmSourceFile *>(arg); return sf->GetProperty(prop); } -int cmSourceFileGetPropertyAsBool(void *arg,const char *prop) +int CCONV cmSourceFileGetPropertyAsBool(void *arg,const char *prop) { cmSourceFile *sf = static_cast<cmSourceFile *>(arg); return (sf->GetPropertyAsBool(prop) ? 1: 0); } -void cmSourceFileSetProperty(void *arg,const char *prop, const char *val) +void CCONV cmSourceFileSetProperty(void *arg,const char *prop, const char *val) { cmSourceFile *sf = static_cast<cmSourceFile *>(arg); sf->SetProperty(prop,val); } -void cmSourceFileAddDepend(void *arg, const char *depend) +void CCONV cmSourceFileAddDepend(void *arg, const char *depend) { cmSourceFile *sf = static_cast<cmSourceFile *>(arg); sf->GetDepends().push_back(depend); } -void cmSourceFileSetName(void *arg, const char* name, const char* dir, +void CCONV cmSourceFileSetName(void *arg, const char* name, const char* dir, int numSourceExtensions, const char **sourceExtensions, int numHeaderExtensions, @@ -571,7 +571,7 @@ void cmSourceFileSetName(void *arg, const char* name, const char* dir, sf->SetName(name,dir, srcs, hdrs); } -void cmSourceFileSetName2(void *arg, const char* name, const char* dir, +void CCONV cmSourceFileSetName2(void *arg, const char* name, const char* dir, const char *ext, int headerFileOnly) { cmSourceFile *sf = static_cast<cmSourceFile *>(arg); @@ -579,7 +579,7 @@ void cmSourceFileSetName2(void *arg, const char* name, const char* dir, } -char *cmGetFilenameWithoutExtension(const char *name) +char * CCONV cmGetFilenameWithoutExtension(const char *name) { std::string sres = cmSystemTools::GetFilenameWithoutExtension(name); char *result = (char *)malloc(sres.size()+1); @@ -587,7 +587,7 @@ char *cmGetFilenameWithoutExtension(const char *name) return result; } -char *cmGetFilenamePath(const char *name) +char * CCONV cmGetFilenamePath(const char *name) { std::string sres = cmSystemTools::GetFilenamePath(name); char *result = (char *)malloc(sres.size()+1); @@ -595,7 +595,7 @@ char *cmGetFilenamePath(const char *name) return result; } -char *cmCapitalized(const char *name) +char * CCONV cmCapitalized(const char *name) { std::string sres = cmSystemTools::Capitalized(name); char *result = (char *)malloc(sres.size()+1); @@ -603,23 +603,23 @@ char *cmCapitalized(const char *name) return result; } -void cmCopyFileIfDifferent(const char *name1, const char *name2) +void CCONV cmCopyFileIfDifferent(const char *name1, const char *name2) { cmSystemTools::CopyFileIfDifferent(name1,name2); } -void cmRemoveFile(const char *name) +void CCONV cmRemoveFile(const char *name) { cmSystemTools::RemoveFile(name); } -void cmDisplayStatus(void *arg, const char* message) +void CCONV cmDisplayStatus(void *arg, const char* message) { cmMakefile *mf = static_cast<cmMakefile *>(arg); mf->DisplayStatus(message, -1); } -void cmFree(void *data) +void CCONV cmFree(void *data) { free(data); } diff --git a/Source/cmCPluginAPI.h b/Source/cmCPluginAPI.h index 246e458234..2910028ad0 100644 --- a/Source/cmCPluginAPI.h +++ b/Source/cmCPluginAPI.h @@ -31,7 +31,12 @@ #ifdef __cplusplus extern "C" { #endif - + +#ifdef __WATCOMC__ +#define CCONV __cdecl +#else +#define CCONV +#endif /*========================================================================= this is the structure of function entry points that a plugin may call. This structure must be kept in sync with the static decaled at the bottom of @@ -46,67 +51,67 @@ typedef struct /* set/Get the ClientData in the cmLoadedCommandInfo structure, this is how information is passed from the InitialPass to FInalPass for commands that need a FinalPass and need information from the InitialPass */ - void *(*GetClientData) (void *info); + void *(CCONV *GetClientData) (void *info); /* return the summed size in characters of all the arguments */ - int (*GetTotalArgumentSize) (int argc, char **argv); + int (CCONV *GetTotalArgumentSize) (int argc, char **argv); /* free all the memory associated with an argc, argv pair */ - void (*FreeArguments) (int argc, char **argv); + void (CCONV *FreeArguments) (int argc, char **argv); /* set/Get the ClientData in the cmLoadedCommandInfo structure, this is how information is passed from the InitialPass to FInalPass for commands that need a FinalPass and need information from the InitialPass */ - void (*SetClientData) (void *info, void *cd); + void (CCONV *SetClientData) (void *info, void *cd); /* when an error occurs, call this function to set the error string */ - void (*SetError) (void *info, const char *err); + void (CCONV *SetError) (void *info, const char *err); /*========================================================================= The following functions all directly map to methods in the cmMakefile class. See cmMakefile.h for descriptions of what each method does. All of these methods take the void * makefile pointer as their first argument. =========================================================================*/ - void (*AddCacheDefinition) (void *mf, const char* name, + void (CCONV *AddCacheDefinition) (void *mf, const char* name, const char* value, const char* doc, int cachetype); - void (*AddCustomCommand) (void *mf, const char* source, + void (CCONV *AddCustomCommand) (void *mf, const char* source, const char* command, int numArgs, const char **args, int numDepends, const char **depends, int numOutputs, const char **outputs, const char *target); - void (*AddDefineFlag) (void *mf, const char* definition); - void (*AddDefinition) (void *mf, const char* name, const char* value); - void (*AddExecutable) (void *mf, const char *exename, + void (CCONV *AddDefineFlag) (void *mf, const char* definition); + void (CCONV *AddDefinition) (void *mf, const char* name, const char* value); + void (CCONV *AddExecutable) (void *mf, const char *exename, int numSrcs, const char **srcs, int win32); - void (*AddLibrary) (void *mf, const char *libname, + void (CCONV *AddLibrary) (void *mf, const char *libname, int shared, int numSrcs, const char **srcs); - void (*AddLinkDirectoryForTarget) (void *mf, const char *tgt, + void (CCONV *AddLinkDirectoryForTarget) (void *mf, const char *tgt, const char* d); - void (*AddLinkLibraryForTarget) (void *mf, const char *tgt, + void (CCONV *AddLinkLibraryForTarget) (void *mf, const char *tgt, const char *libname, int libtype); - void (*AddUtilityCommand) (void *mf, const char* utilityName, + void (CCONV *AddUtilityCommand) (void *mf, const char* utilityName, const char *command, const char *arguments, int all, int numDepends, const char **depends, int numOutputs, const char **outputs); - int (*CommandExists) (void *mf, const char* name); - int (*ExecuteCommand) (void *mf, const char *name, + int (CCONV *CommandExists) (void *mf, const char* name); + int (CCONV *ExecuteCommand) (void *mf, const char *name, int numArgs, const char **args); - void (*ExpandSourceListArguments) (void *mf,int argc, const char **argv, + void (CCONV *ExpandSourceListArguments) (void *mf,int argc, const char **argv, int *resArgc, char ***resArgv, unsigned int startArgumentIndex); - char *(*ExpandVariablesInString) (void *mf, const char *source, + char *(CCONV *ExpandVariablesInString) (void *mf, const char *source, int escapeQuotes, int atOnly); - unsigned int (*GetCacheMajorVersion) (void *mf); - unsigned int (*GetCacheMinorVersion) (void *mf); - const char* (*GetCurrentDirectory) (void *mf); - const char* (*GetCurrentOutputDirectory) (void *mf); - const char* (*GetDefinition) (void *mf, const char *def); - const char* (*GetHomeDirectory) (void *mf); - const char* (*GetHomeOutputDirectory) (void *mf); - unsigned int (*GetMajorVersion) (void *mf); - unsigned int (*GetMinorVersion) (void *mf); - const char* (*GetProjectName) (void *mf); - const char* (*GetStartDirectory) (void *mf); - const char* (*GetStartOutputDirectory) (void *mf); - int (*IsOn) (void *mf, const char* name); + unsigned int (CCONV *GetCacheMajorVersion) (void *mf); + unsigned int (CCONV *GetCacheMinorVersion) (void *mf); + const char* (CCONV *GetCurrentDirectory) (void *mf); + const char* (CCONV *GetCurrentOutputDirectory) (void *mf); + const char* (CCONV *GetDefinition) (void *mf, const char *def); + const char* (CCONV *GetHomeDirectory) (void *mf); + const char* (CCONV *GetHomeOutputDirectory) (void *mf); + unsigned int (CCONV *GetMajorVersion) (void *mf); + unsigned int (CCONV *GetMinorVersion) (void *mf); + const char* (CCONV *GetProjectName) (void *mf); + const char* (CCONV *GetStartDirectory) (void *mf); + const char* (CCONV *GetStartOutputDirectory) (void *mf); + int (CCONV *IsOn) (void *mf, const char* name); /*========================================================================= @@ -114,23 +119,23 @@ typedef struct cmSourceFiles. Please see cmSourceFile.h for additional information on many of these methods. Some of these methods are in cmMakefile.h. =========================================================================*/ - void *(*AddSource) (void *mf, void *sf); - void *(*CreateSourceFile) (); - void (*DestroySourceFile) (void *sf); - void *(*GetSource) (void *mf, const char* sourceName); - void (*SourceFileAddDepend) (void *sf, const char *depend); - const char *(*SourceFileGetProperty) (void *sf, const char *prop); - int (*SourceFileGetPropertyAsBool) (void *sf, const char *prop); - const char *(*SourceFileGetSourceName) (void *sf); - const char *(*SourceFileGetFullPath) (void *sf); - void (*SourceFileSetName) (void *sf, const char* name, const char* dir, + void *(CCONV *AddSource) (void *mf, void *sf); + void *(CCONV *CreateSourceFile) (); + void (CCONV *DestroySourceFile) (void *sf); + void *(CCONV *GetSource) (void *mf, const char* sourceName); + void (CCONV *SourceFileAddDepend) (void *sf, const char *depend); + const char *(CCONV *SourceFileGetProperty) (void *sf, const char *prop); + int (CCONV *SourceFileGetPropertyAsBool) (void *sf, const char *prop); + const char *(CCONV *SourceFileGetSourceName) (void *sf); + const char *(CCONV *SourceFileGetFullPath) (void *sf); + void (CCONV *SourceFileSetName) (void *sf, const char* name, const char* dir, int numSourceExtensions, const char **sourceExtensions, int numHeaderExtensions, const char **headerExtensions); - void (*SourceFileSetName2) (void *sf, const char* name, const char* dir, + void (CCONV *SourceFileSetName2) (void *sf, const char* name, const char* dir, const char *ext, int headerFileOnly); - void (*SourceFileSetProperty) (void *sf, const char *prop, + void (CCONV *SourceFileSetProperty) (void *sf, const char *prop, const char *value); @@ -138,28 +143,28 @@ typedef struct The following methods are from cmSystemTools.h see that file for specific documentation on each method. =========================================================================*/ - char *(*Capitalized)(const char *); - void (*CopyFileIfDifferent)(const char *f1, const char *f2); - char *(*GetFilenameWithoutExtension)(const char *); - char *(*GetFilenamePath)(const char *); - void (*RemoveFile)(const char *f1); - void (*Free)(void *); + char *(CCONV *Capitalized)(const char *); + void (CCONV *CopyFileIfDifferent)(const char *f1, const char *f2); + char *(CCONV *GetFilenameWithoutExtension)(const char *); + char *(CCONV *GetFilenamePath)(const char *); + void (CCONV *RemoveFile)(const char *f1); + void (CCONV *Free)(void *); /*========================================================================= The following are new functions added after 1.6 =========================================================================*/ - void (*AddCustomCommandToOutput) (void *mf, const char* output, + void (CCONV *AddCustomCommandToOutput) (void *mf, const char* output, const char* command, int numArgs, const char **args, const char* main_dependency, int numDepends, const char **depends); - void (*AddCustomCommandToTarget) (void *mf, const char* target, + void (CCONV *AddCustomCommandToTarget) (void *mf, const char* target, const char* command, int numArgs, const char **args, int commandType); /* display status information */ - void (*DisplaySatus) (void *info, const char *message); + void (CCONV *DisplaySatus) (void *info, const char *message); /* this is the end of the C function stub API structure */ } cmCAPI; @@ -202,11 +207,11 @@ define the different types of custom commands for a target /*========================================================================= Finally we define the key data structures and function prototypes =========================================================================*/ - typedef const char* (*CM_DOC_FUNCTION)(); - typedef int (*CM_INITIAL_PASS_FUNCTION)(void *info, void *mf, + typedef const char* (CCONV *CM_DOC_FUNCTION)(); + typedef int (CCONV *CM_INITIAL_PASS_FUNCTION)(void *info, void *mf, int argc, char *[]); - typedef void (*CM_FINAL_PASS_FUNCTION)(void *info, void *mf); - typedef void (*CM_DESTRUCTOR_FUNCTION)(void *info); + typedef void (CCONV *CM_FINAL_PASS_FUNCTION)(void *info, void *mf); + typedef void (CCONV *CM_DESTRUCTOR_FUNCTION)(void *info); typedef struct { unsigned long reserved1; /* Reserved for future use. DO NOT USE. */ @@ -223,7 +228,7 @@ Finally we define the key data structures and function prototypes void *ClientData; } cmLoadedCommandInfo; - typedef void (*CM_INIT_FUNCTION)(cmLoadedCommandInfo *); + typedef void (CCONV *CM_INIT_FUNCTION)(cmLoadedCommandInfo *); #ifdef __cplusplus } diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index 411779144d..d76b6be41e 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -135,6 +135,11 @@ void cmGlobalUnixMakefileGenerator3::WriteMainMakefile2() // target so that make with no arguments will run it. // Just depend on the all target to drive the build. std::vector<std::string> depends; + const char* sym = lg->GetMakefile()->GetDefinition("CMAKE_MAKE_SYMBOLIC_RULE"); + if(sym) + { + depends.push_back(sym); + } std::vector<std::string> no_commands; depends.push_back("all"); @@ -146,10 +151,16 @@ void cmGlobalUnixMakefileGenerator3::WriteMainMakefile2() depends, no_commands); + depends.clear(); + if(sym) + { + depends.push_back(sym); + } + // Write and empty all: lg->WriteMakeRule(makefileStream, "The main recursive all target", "all", - no_commands, no_commands); + depends, no_commands); lg->WriteMakeVariables(makefileStream); @@ -590,6 +601,7 @@ cmGlobalUnixMakefileGenerator3 for (i = 0; i < m_LocalGenerators.size(); ++i) { lg = static_cast<cmLocalUnixMakefileGenerator3 *>(m_LocalGenerators[i]); + const char* sym = lg->GetMakefile()->GetDefinition("CMAKE_MAKE_SYMBOLIC_RULE"); // for each target Generate the rule files for each target. cmTargets& targets = lg->GetMakefile()->GetTargets(); @@ -617,7 +629,11 @@ cmGlobalUnixMakefileGenerator3 commands.clear(); commands.push_back(lg->GetRecursiveMakeCall("CMakeFiles/Makefile2", t->second.GetName())); - depends.clear(); + depends.clear(); + if(sym) + { + depends.push_back(sym); + } depends.push_back("cmake_check_build_system"); lg->WriteMakeRule(ruleFileStream, "Build rule for target.", @@ -695,6 +711,11 @@ cmGlobalUnixMakefileGenerator3 // Write the rule. localName += "/all"; depends.clear(); + const char* sym = lg->GetMakefile()->GetDefinition("CMAKE_MAKE_SYMBOLIC_RULE"); + if(sym) + { + depends.push_back(sym); + } this->AppendGlobalTargetDepends(depends,t->second); lg->WriteMakeRule(ruleFileStream, "All Build rule for target.", localName.c_str(), depends, commands); @@ -714,6 +735,10 @@ cmGlobalUnixMakefileGenerator3 commands.push_back(lg->GetRecursiveMakeCall("CMakeFiles/Makefile2", localName.c_str())); depends.clear(); + if(sym) + { + depends.push_back(sym); + } depends.push_back("cmake_check_build_system"); localName = lg->GetRelativeTargetDirectory(t->second); localName += "/rule"; @@ -733,6 +758,10 @@ cmGlobalUnixMakefileGenerator3 makeTargetName = localName; makeTargetName += "/clean"; depends.clear(); + if(sym) + { + depends.push_back(sym); + } commands.clear(); commands.push_back(lg->GetRecursiveMakeCall(makefileName.c_str(), makeTargetName.c_str())); @@ -905,6 +934,11 @@ void cmGlobalUnixMakefileGenerator3::WriteHelpRule } } } + const char* sym = lg->GetMakefile()->GetDefinition("CMAKE_MAKE_SYMBOLIC_RULE"); + if(sym) + { + no_depends.push_back(sym); + } lg->WriteMakeRule(ruleFileStream, "Help Target", "help:", no_depends, commands); diff --git a/Source/cmGlobalWatcomWMakeGenerator.cxx b/Source/cmGlobalWatcomWMakeGenerator.cxx new file mode 100644 index 0000000000..a7c3770bf1 --- /dev/null +++ b/Source/cmGlobalWatcomWMakeGenerator.cxx @@ -0,0 +1,65 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#include "cmGlobalWatcomWMakeGenerator.h" +#include "cmLocalUnixMakefileGenerator3.h" +#include "cmMakefile.h" + +cmGlobalWatcomWMakeGenerator::cmGlobalWatcomWMakeGenerator() +{ + m_FindMakeProgramFile = "CMakeFindWMake.cmake"; + m_ForceUnixPaths = false; +} + +void cmGlobalWatcomWMakeGenerator::EnableLanguage(std::vector<std::string>const& l, + cmMakefile *mf) +{ + // pick a default + mf->AddDefinition("WATCOM", "1"); + mf->AddDefinition("CMAKE_MANGLE_OBJECT_FILE_NAMES", "1"); + mf->AddDefinition("CMAKE_WINDOWS_OBJECT_PATH", "1"); + mf->AddDefinition("CMAKE_MAKE_LINE_CONTINUE", "&"); + mf->AddDefinition("CMAKE_MAKE_SYMBOLIC_RULE", ".SYMBOLIC"); + mf->AddDefinition("CMAKE_NO_QUOTED_OBJECTS", "1"); + mf->AddDefinition("CMAKE_GENERATOR_CC", "wcl386"); + mf->AddDefinition("CMAKE_GENERATOR_CXX", "wcl386"); + this->cmGlobalUnixMakefileGenerator3::EnableLanguage(l, mf); +} + +///! Create a local generator appropriate to this Global Generator +cmLocalGenerator *cmGlobalWatcomWMakeGenerator::CreateLocalGenerator() +{ + cmLocalUnixMakefileGenerator3* lg = new cmLocalUnixMakefileGenerator3; + lg->SetSilentNoColon(true); + lg->SetEchoNeedsQuote(false); + lg->SetDefineWindowsNULL(true); + lg->SetWindowsShell(true); + lg->SetMakeSilentFlag("-s -h"); + lg->SetGlobalGenerator(this); + lg->SetIgnoreLibPrefix(true); + lg->SetPassMakeflags(false); + lg->SetUnixCD(false); + lg->SetIncludeDirective("!include"); + return lg; +} + +//---------------------------------------------------------------------------- +void cmGlobalWatcomWMakeGenerator::GetDocumentation(cmDocumentationEntry& entry) const +{ + entry.name = this->GetName(); + entry.brief = "Generates Watcom WMake makefiles."; + entry.full = ""; +} diff --git a/Source/cmGlobalWatcomWMakeGenerator.h b/Source/cmGlobalWatcomWMakeGenerator.h new file mode 100644 index 0000000000..2a36edc887 --- /dev/null +++ b/Source/cmGlobalWatcomWMakeGenerator.h @@ -0,0 +1,50 @@ +/*========================================================================= + + Program: CMake - Cross-Platform Makefile Generator + Module: $RCSfile$ + Language: C++ + Date: $Date$ + Version: $Revision$ + + Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved. + See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. + + This software is distributed WITHOUT ANY WARRANTY; without even + the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR + PURPOSE. See the above copyright notices for more information. + +=========================================================================*/ +#ifndef cmGlobalWatcomWMakeGenerator_h +#define cmGlobalWatcomWMakeGenerator_h + +#include "cmGlobalUNIXMakefileGenerator3.h" + +/** \class cmGlobalWatcomWMakeGenerator + * \brief Write a NMake makefiles. + * + * cmGlobalWatcomWMakeGenerator manages nmake build process for a tree + */ +class cmGlobalWatcomWMakeGenerator : public cmGlobalUnixMakefileGenerator3 +{ +public: + cmGlobalWatcomWMakeGenerator(); + static cmGlobalGenerator* New() { return new cmGlobalWatcomWMakeGenerator; } + ///! Get the name for the generator. + virtual const char* GetName() const { + return cmGlobalWatcomWMakeGenerator::GetActualName();} + static const char* GetActualName() {return "Watcom WMake";} + + /** Get the documentation entry for this generator. */ + virtual void GetDocumentation(cmDocumentationEntry& entry) const; + + ///! Create a local generator appropriate to this Global Generator + virtual cmLocalGenerator *CreateLocalGenerator(); + + /** + * Try to determine system infomation such as shared library + * extension, pthreads, byte order etc. + */ + virtual void EnableLanguage(std::vector<std::string>const& languages, cmMakefile *); +}; + +#endif diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index c66bdeaeee..8d4c46b106 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -41,6 +41,7 @@ //---------------------------------------------------------------------------- cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3() { + m_SilentNoColon = false; m_WindowsShell = false; m_IncludeDirective = "include"; m_MakefileVariableSize = 0; @@ -609,7 +610,10 @@ cmLocalUnixMakefileGenerator3 std::string relativeObj = this->GetHomeRelativeOutputPath(); relativeObj += obj; - + if(m_Makefile->GetDefinition("CMAKE_WINDOWS_OBJECT_PATH")) + { + relativeObj = cmSystemTools::ConvertToOutputPath(relativeObj.c_str()); + } // Write the build rule. // Build the set of compiler flags. std::string flags; @@ -849,6 +853,11 @@ cmLocalUnixMakefileGenerator3 // Collect the commands and dependencies. std::vector<std::string> commands; std::vector<std::string> depends; + const char* sym = m_Makefile->GetDefinition("CMAKE_MAKE_SYMBOLIC_RULE"); + if(sym) + { + depends.push_back(sym); + } // Utility targets store their rules in pre- and post-build commands. this->AppendCustomDepends(depends, target.GetPreBuildCommands()); @@ -1122,6 +1131,11 @@ cmLocalUnixMakefileGenerator3 // Write special "install" target to run cmake_install.cmake script. { std::vector<std::string> depends; + const char* sym = m_Makefile->GetDefinition("CMAKE_MAKE_SYMBOLIC_RULE"); + if(sym) + { + depends.push_back(sym); + } std::vector<std::string> commands; std::string cmd; if(m_Makefile->GetDefinition("CMake_BINARY_DIR")) @@ -1150,9 +1164,14 @@ cmLocalUnixMakefileGenerator3 "install", depends, commands); } + std::vector<std::string> no_depends; + const char* sym = m_Makefile->GetDefinition("CMAKE_MAKE_SYMBOLIC_RULE"); + if(sym) + { + no_depends.push_back(sym); + } // Write special "rebuild_cache" target to re-run cmake. { - std::vector<std::string> no_depends; std::vector<std::string> commands; this->AppendEcho(commands, "Running CMake to regenerate build system..."); commands.push_back( @@ -1168,7 +1187,6 @@ cmLocalUnixMakefileGenerator3 // Otherwise default to the interactive command-line interface. if(m_Makefile->GetDefinition("CMAKE_EDIT_COMMAND")) { - std::vector<std::string> no_depends; std::vector<std::string> commands; this->AppendEcho(commands, "Running CMake cache editor..."); commands.push_back( @@ -1181,7 +1199,6 @@ cmLocalUnixMakefileGenerator3 } else { - std::vector<std::string> no_depends; std::vector<std::string> commands; this->AppendEcho(commands, "Running interactive CMake command-line interface..."); @@ -1201,8 +1218,8 @@ cmLocalUnixMakefileGenerator3 // name of this special target. This gives a make-time choice to // the user. std::vector<std::string> commands; + no_depends.clear(); commands.clear(); - std::vector<std::string> no_depends; if(m_Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE")) { makefileStream @@ -1210,12 +1227,18 @@ cmLocalUnixMakefileGenerator3 << "VERBOSE = 1\n" << "\n"; } - - this->WriteMakeRule(makefileStream, - "Suppress display of executed commands.", - "$(VERBOSE).SILENT", - no_depends, - commands); + if(m_SilentNoColon) + { + makefileStream << "$(VERBOSE).SILENT\n"; + } + else + { + this->WriteMakeRule(makefileStream, + "Suppress display of executed commands.", + "$(VERBOSE).SILENT", + no_depends, + commands); + } // Special target to cleanup operation of make tool. std::vector<std::string> depends; @@ -1255,6 +1278,12 @@ cmLocalUnixMakefileGenerator3 std::vector<std::string> no_depends; std::vector<std::string> commands; commands.push_back(runRule); + const char* sym = m_Makefile->GetDefinition("CMAKE_MAKE_SYMBOLIC_RULE"); + if(sym) + { + no_depends.push_back(sym); + } + this->WriteMakeRule(makefileStream, "Special rule to run CMake to check the build system " "integrity.\n" @@ -1284,6 +1313,11 @@ cmLocalUnixMakefileGenerator3 { // The helper target depends on the real target. std::vector<std::string> depends; + const char* sym = m_Makefile->GetDefinition("CMAKE_MAKE_SYMBOLIC_RULE"); + if(sym) + { + depends.push_back(sym); + } depends.push_back(realTarget); // There are no commands. @@ -1956,12 +1990,25 @@ cmLocalUnixMakefileGenerator3 << "# Object files for target " << target.GetName() << "\n" << variableName.c_str() << " ="; std::string object; + const char* objName = m_Makefile->GetDefinition("CMAKE_NO_QUOTED_OBJECTS"); + const char* lineContinue = m_Makefile->GetDefinition("CMAKE_MAKE_LINE_CONTINUE"); + if(!lineContinue) + { + lineContinue = "\\"; + } for(std::vector<std::string>::const_iterator i = objects.begin(); i != objects.end(); ++i) { ruleFileStream - << " \\\n" - << this->ConvertToQuotedOutputPath(i->c_str()); + << " " << lineContinue << "\n"; + if(objName) + { + ruleFileStream << this->Convert(i->c_str(), START_OUTPUT, MAKEFILE); + } + else + { + ruleFileStream << this->ConvertToQuotedOutputPath(i->c_str()); + } } ruleFileStream << "\n"; @@ -1979,8 +2026,16 @@ cmLocalUnixMakefileGenerator3 { object = this->Convert(i->c_str(),START_OUTPUT); ruleFileStream - << " \\\n" - << this->ConvertToQuotedOutputPath(object.c_str()); + << " " << lineContinue << "\n" + << m_Makefile->GetSafeDefinition("CMAKE_OBJECT_NAME"); + if(objName) + { + ruleFileStream << this->Convert(i->c_str(), START_OUTPUT, MAKEFILE); + } + else + { + ruleFileStream << this->ConvertToQuotedOutputPath(i->c_str()); + } } ruleFileStream << "\n" @@ -2053,7 +2108,12 @@ cmLocalUnixMakefileGenerator3 cmTarget& target, const std::vector<std::string>& files) { - std::vector<std::string> no_depends; + std::vector<std::string> depends; + const char* sym = m_Makefile->GetDefinition("CMAKE_MAKE_SYMBOLIC_RULE"); + if(sym) + { + depends.push_back(sym); + } std::vector<std::string> commands; // Construct the clean target name. @@ -2066,7 +2126,7 @@ cmLocalUnixMakefileGenerator3 m_Makefile->GetHomeOutputDirectory()); // Write the rule. this->WriteMakeRule(ruleFileStream, 0, - cleanTarget.c_str(), no_depends, commands); + cleanTarget.c_str(), depends, commands); } @@ -2210,6 +2270,7 @@ cmLocalUnixMakefileGenerator3 std::string cmLocalUnixMakefileGenerator3::ConvertToQuotedOutputPath(const char* p) { + // Split the path into its components. std::vector<std::string> components; cmSystemTools::SplitPath(p, components); @@ -2894,6 +2955,11 @@ void cmLocalUnixMakefileGenerator3 dir += "/directorystart"; dir = this->Convert(dir.c_str(),HOME_OUTPUT,MAKEFILE); // if at the top the rule is called all + const char* sym = m_Makefile->GetDefinition("CMAKE_MAKE_SYMBOLIC_RULE"); + if(sym) + { + depends.push_back(sym); + } if (!m_Parent) { dir = "all"; @@ -2908,11 +2974,19 @@ void cmLocalUnixMakefileGenerator3 dir = this->Convert(dir.c_str(),HOME_OUTPUT,MAKEFILE); commands.clear(); depends.clear(); + if(sym) + { + depends.push_back(sym); + } this->CreateJumpCommand(commands,"CMakeFiles/Makefile2",dir); this->WriteMakeRule(ruleFileStream, "The main clean target", "clean", depends, commands); // write the depend rule, really a recompute depends rule depends.clear(); + if(sym) + { + depends.push_back(sym); + } commands.clear(); std::string cmakefileName = "CMakeFiles/Makefile.cmake"; this->Convert(cmakefileName.c_str(),HOME_OUTPUT, diff --git a/Source/cmLocalUnixMakefileGenerator3.h b/Source/cmLocalUnixMakefileGenerator3.h index b7a5b9ba84..a744b94b69 100644 --- a/Source/cmLocalUnixMakefileGenerator3.h +++ b/Source/cmLocalUnixMakefileGenerator3.h @@ -116,6 +116,12 @@ public: void SetUnixCD(bool v) {m_UnixCD = v;} /** + * Set Support Verbose Variable. If true, then .SILENT will + * be not end with : i.e. .SILENT: or .SILENT + */ + void SetSilentNoColon(bool v) {m_SilentNoColon = v;} + + /** * Set the string used to include one makefile into another default * is include. */ @@ -365,6 +371,7 @@ private: bool m_DefineWindowsNULL; bool m_UnixCD; bool m_PassMakeflags; + bool m_SilentNoColon; //========================================================================== // Flag for whether echo command needs quotes. diff --git a/Source/cmStringCommand.h b/Source/cmStringCommand.h index fc846d37cc..3b71c25508 100644 --- a/Source/cmStringCommand.h +++ b/Source/cmStringCommand.h @@ -131,6 +131,7 @@ protected: RegexReplacement(const char* s): number(-1), value(s) {} RegexReplacement(const std::string& s): number(-1), value(s) {} RegexReplacement(int n): number(n), value() {} + RegexReplacement() {}; int number; std::string value; }; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 27702d9194..679b441ee6 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -47,6 +47,7 @@ # endif # include "cmGlobalBorlandMakefileGenerator.h" # include "cmGlobalNMakeMakefileGenerator.h" +# include "cmGlobalWatcomWMakeGenerator.h" # include "cmGlobalMSYSMakefileGenerator.h" # include "cmGlobalMinGWMakefileGenerator.h" # include "cmWin32ProcessExecution.h" @@ -1606,6 +1607,8 @@ void cmake::AddDefaultGenerators() &cmGlobalBorlandMakefileGenerator::New; m_Generators[cmGlobalNMakeMakefileGenerator::GetActualName()] = &cmGlobalNMakeMakefileGenerator::New; + m_Generators[cmGlobalWatcomWMakeGenerator::GetActualName()] = + &cmGlobalWatcomWMakeGenerator::New; m_Generators[cmGlobalMSYSMakefileGenerator::GetActualName()] = &cmGlobalMSYSMakefileGenerator::New; m_Generators[cmGlobalMinGWMakefileGenerator::GetActualName()] = diff --git a/Source/kwsys/Directory.cxx b/Source/kwsys/Directory.cxx index e98c259448..fefdab850d 100644 --- a/Source/kwsys/Directory.cxx +++ b/Source/kwsys/Directory.cxx @@ -74,7 +74,7 @@ const char* Directory::GetFile(unsigned long dindex) // First microsoft compilers -#ifdef _MSC_VER +#if defined(_MSC_VER) || defined(__WATCOMC__) #include <windows.h> #include <io.h> #include <ctype.h> diff --git a/Source/kwsys/EncodeExecutable.c b/Source/kwsys/EncodeExecutable.c index a0cdcd788b..d7c9a459b5 100644 --- a/Source/kwsys/EncodeExecutable.c +++ b/Source/kwsys/EncodeExecutable.c @@ -12,7 +12,9 @@ =========================================================================*/ #include <stdio.h> - +#ifdef __WATCOMC__ +#define _unlink unlink +#endif int main(int argc, char* argv[]) { FILE* ifp; @@ -76,6 +78,9 @@ int main(int argc, char* argv[]) fprintf(ofp, "extern %s_EXPORT int %sEncodedWriteArray%s(const char* fname)\n", argv[3], argv[3], argv[4]); fprintf(ofp, "{\n"); + fprintf(ofp, "#ifdef __WATCOMC__\n"); + fprintf(ofp, "#define _unlink unlink\n"); + fprintf(ofp, "#endif\n"); fprintf(ofp, " FILE* ofp = fopen(fname, \"wb\");\n"); fprintf(ofp, " if(!ofp) { return 0; }\n"); for(i=0; i < count; ++i) diff --git a/Source/kwsys/Glob.cxx b/Source/kwsys/Glob.cxx index 823f59ec1b..7617458757 100644 --- a/Source/kwsys/Glob.cxx +++ b/Source/kwsys/Glob.cxx @@ -35,7 +35,7 @@ #include <ctype.h> #include <stdio.h> - +#include <string.h> namespace KWSYS_NAMESPACE { #if defined( _WIN32 ) || defined( APPLE ) || defined( __CYGWIN__ ) diff --git a/Source/kwsys/ProcessWin32.c b/Source/kwsys/ProcessWin32.c index 6c2fe28caf..9a0b6ebbe1 100644 --- a/Source/kwsys/ProcessWin32.c +++ b/Source/kwsys/ProcessWin32.c @@ -45,6 +45,9 @@ Q190351 and Q150956. #include <string.h> /* strlen, strdup */ #include <stdio.h> /* sprintf */ #include <io.h> /* _unlink */ +#ifdef __WATCOMC__ +#define _unlink unlink +#endif #ifndef _MAX_FNAME #define _MAX_FNAME 4096 diff --git a/Source/kwsys/Registry.cxx b/Source/kwsys/Registry.cxx index 97d854d98d..3c0be26743 100644 --- a/Source/kwsys/Registry.cxx +++ b/Source/kwsys/Registry.cxx @@ -367,9 +367,7 @@ RegistryHelper::~RegistryHelper() bool RegistryHelper::Open(const char *toplevel, const char *subkey, int readonly) { - this->EntriesMap.erase( - this->EntriesMap.begin(), - this->EntriesMap.end()); + this->EntriesMap.clear(); m_Empty = 1; #ifdef _WIN32 @@ -416,7 +414,7 @@ bool RegistryHelper::Open(const char *toplevel, const char *subkey, } } m_HomeDirectory = homeDirectory; - str << m_HomeDirectory << "/." << toplevel << "rc"; + str << m_HomeDirectory.c_str() << "/." << toplevel << "rc"; if ( readonly == Registry::READWRITE ) { kwsys_ios::ofstream ofs( str.str().c_str(), kwsys_ios::ios::out|kwsys_ios::ios::app ); @@ -503,7 +501,7 @@ bool RegistryHelper::Close() } kwsys_ios::ostringstream str; - str << m_HomeDirectory << "/." << this->GetTopLevel() << "rc"; + str << m_HomeDirectory.c_str() << "/." << this->GetTopLevel() << "rc"; kwsys_ios::ofstream *ofs = new kwsys_ios::ofstream(str.str().c_str(), kwsys_ios::ios::out); if ( !ofs ) { @@ -531,9 +529,7 @@ bool RegistryHelper::Close() *ofs << it->first.c_str() << " = " << this->EncodeValue(it->second.c_str()).c_str() << kwsys_ios::endl; } } - this->EntriesMap.erase( - this->EntriesMap.begin(), - this->EntriesMap.end()); + this->EntriesMap.clear(); ofs->close(); delete ofs; this->SetSubKey(0); @@ -673,7 +669,8 @@ kwsys_stl::string RegistryHelper::CreateKey( const char *key ) return ""; } kwsys_ios::ostringstream ostr; - ostr << this->EncodeKey(this->m_SubKey.c_str()) << "\\" << this->EncodeKey(key); + ostr << this->EncodeKey(this->m_SubKey.c_str()).c_str() + << "\\" << this->EncodeKey(key).c_str(); return ostr.str(); } diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx index e406723d5e..cd3526ca51 100644 --- a/Source/kwsys/SystemTools.cxx +++ b/Source/kwsys/SystemTools.cxx @@ -85,7 +85,7 @@ public: } #endif -#if defined(_WIN32) && (defined(_MSC_VER) || defined(__BORLANDC__) || defined(__MINGW32__)) +#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) ||defined(__BORLANDC__) || defined(__MINGW32__)) #include <io.h> #include <direct.h> #define _unlink unlink @@ -99,8 +99,15 @@ public: #else # define KWSYS_SYSTEMTOOLS_MAXPATH 16384 #endif +#if defined(__WATCOMC__) +#include <direct.h> +#define _mkdir mkdir +#define _rmdir rmdir +#define _getcwd getcwd +#define _chdir chdir +#endif -#if defined(_WIN32) && (defined(_MSC_VER) || defined(__BORLANDC__) || defined(__MINGW32__)) +#if defined(_WIN32) && (defined(_MSC_VER) || defined(__WATCOMC__) || defined(__BORLANDC__) || defined(__MINGW32__)) inline int Mkdir(const char* dir) { return _mkdir(dir); @@ -1856,7 +1863,11 @@ kwsys_stl::string SystemTools SystemTools::GetPath(path, "CMAKE_FILE_PATH"); SystemTools::GetPath(path); // now add the additional paths - path.insert(path.end(), userPaths.begin(), userPaths.end()); + for(kwsys_stl::vector<kwsys_stl::string>::const_iterator i = userPaths.begin(); + i != userPaths.end(); ++i) + { + path.push_back(*i); + } // now look for the file kwsys_stl::string tryPath; for(kwsys_stl::vector<kwsys_stl::string>::const_iterator p = path.begin(); @@ -1911,8 +1922,11 @@ kwsys_stl::string SystemTools::FindProgram( } // now add the additional paths - path.insert(path.end(), userPaths.begin(), userPaths.end()); - + for(kwsys_stl::vector<kwsys_stl::string>::const_iterator i = userPaths.begin(); + i != userPaths.end(); ++i) + { + path.push_back(*i); + } for(kwsys_stl::vector<kwsys_stl::string>::const_iterator p = path.begin(); p != path.end(); ++p) { @@ -1987,7 +2001,11 @@ kwsys_stl::string SystemTools kwsys_stl::vector<kwsys_stl::string> path; SystemTools::GetPath(path); // now add the additional paths - path.insert(path.end(), userPaths.begin(), userPaths.end()); + for(kwsys_stl::vector<kwsys_stl::string>::const_iterator i = userPaths.begin(); + i != userPaths.end(); ++i) + { + path.push_back(*i); + } kwsys_stl::string tryPath; for(kwsys_stl::vector<kwsys_stl::string>::const_iterator p = path.begin(); p != path.end(); ++p) diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in index bdc327b10d..9d5926dd08 100644 --- a/Source/kwsys/SystemTools.hxx.in +++ b/Source/kwsys/SystemTools.hxx.in @@ -18,6 +18,7 @@ #include <@KWSYS_NAMESPACE@/stl/string> #include <@KWSYS_NAMESPACE@/stl/vector> #include <@KWSYS_NAMESPACE@/stl/map> +#include <@KWSYS_NAMESPACE@/stl/algorithm> #include <@KWSYS_NAMESPACE@/Configure.h> diff --git a/Source/kwsys/kwsysPlatformCxxTests.cxx b/Source/kwsys/kwsysPlatformCxxTests.cxx index 77e0d1c8d5..e9216765c6 100644 --- a/Source/kwsys/kwsysPlatformCxxTests.cxx +++ b/Source/kwsys/kwsysPlatformCxxTests.cxx @@ -26,7 +26,16 @@ int main() { return 0; } #ifdef TEST_KWSYS_IOS_USE_SSTREAM #include <sstream> -int main() { return 0; } +int main() +{ + std::ostringstream ostr; + ostr << "hello"; + if(ostr.str().size() == 5) + { + return 0; + } + return -1; +} #endif #ifdef TEST_KWSYS_IOS_USE_STRSTREAM_H diff --git a/Source/kwsys/testRegistry.cxx b/Source/kwsys/testRegistry.cxx index 1c31163bcf..09e973766b 100644 --- a/Source/kwsys/testRegistry.cxx +++ b/Source/kwsys/testRegistry.cxx @@ -16,6 +16,7 @@ #include KWSYS_HEADER(Registry.hxx) #include KWSYS_HEADER(ios/iostream) +#include <string.h> // Work-around CMake dependency scanning limitation. This must // duplicate the above list of headers. diff --git a/Tests/Complex/Executable/CMakeLists.txt b/Tests/Complex/Executable/CMakeLists.txt index e3e11eac81..78ed5878ed 100644 --- a/Tests/Complex/Executable/CMakeLists.txt +++ b/Tests/Complex/Executable/CMakeLists.txt @@ -19,7 +19,10 @@ LINK_LIBRARIES(${COMPLEX_LIBS}) ADD_EXECUTABLE(A A.cxx) ADD_EXECUTABLE(complex complex testcflags.c) ADD_EXECUTABLE(complex.file complex.file.cxx) -TARGET_LINK_LIBRARIES(complex CMakeLib cmsys cmexpat cmzlib cmtar) +IF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) + TARGET_LINK_LIBRARIES(complex CMakeLib cmsys cmexpat cmzlib cmtar) +ENDIF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) + IF (UNIX) TARGET_LINK_LIBRARIES(complex ${CMAKE_DL_LIBS}) ELSE(UNIX) diff --git a/Tests/Complex/Executable/complex.cxx b/Tests/Complex/Executable/complex.cxx index 9fac9abefd..06af8ec974 100644 --- a/Tests/Complex/Executable/complex.cxx +++ b/Tests/Complex/Executable/complex.cxx @@ -8,19 +8,44 @@ extern "C" { #include "testConly.h" } +#ifndef CMAKE_TEST_DIFFERENT_GENERATOR #include "cmStandardIncludes.h" #include "cmSystemTools.h" #include "cmDynamicLoader.h" #include "cmSystemTools.h" #include "cmOrderLinkDirectories.h" #include "cmGeneratedFileStream.h" +#else +#include <vector> +#include <string> +#include <iostream> +#include <string.h> +#endif + int cm_passed = 0; int cm_failed = 0; +// ====================================================================== + +void cmFailed(const char* Message, const char* m2= "", const char* m3 = "") +{ + std::cout << "FAILED: " << Message << m2 << m3 << "\n"; + cm_failed++; +} + +// ====================================================================== + +void cmPassed(const char* Message, const char* m2="") +{ + std::cout << "Passed: " << Message << m2 << "\n"; + cm_passed++; +} #ifndef CMAKE_IS_REALLY_FUN This is a problem. Looks like ADD_DEFINITIONS and REMOVE_DEFINITIONS does not work #endif + +#ifndef CMAKE_TEST_DIFFERENT_GENERATOR // Here is a stupid function that tries to use std::string methods // so that the dec cxx compiler will instantiate the stuff that // we are using from the CMakeLib library.... @@ -99,43 +124,6 @@ bool TestLibraryOrder(bool shouldFail) return ret; } -void ForceStringUse() -{ - std::vector<std::string> v; - std::vector<std::string> v2; - v = v2; - std::string cachetest = CACHE_TEST_VAR_INTERNAL; - v.push_back(cachetest); - v2 = v; - std::string x(5,'x'); - char buff[5]; - x.copy(buff, 1, 0); - x[0] = 'a'; - std::string::size_type pos = 0; - x.replace(pos, pos, pos, 'x'); - std::string copy = cachetest; - cachetest.find("bar"); - cachetest.rfind("bar"); - copy.append(cachetest); - copy = cachetest.substr(0, cachetest.size()); -} - -// ====================================================================== - -void cmFailed(const char* Message, const char* m2= "", const char* m3 = "") -{ - std::cout << "FAILED: " << Message << m2 << m3 << "\n"; - cm_failed++; -} - -// ====================================================================== - -void cmPassed(const char* Message, const char* m2="") -{ - std::cout << "Passed: " << Message << m2 << "\n"; - cm_passed++; -} - // ====================================================================== void TestAndRemoveFile(const char* filename) @@ -258,6 +246,30 @@ void TestCMGeneratedFileSTream() cmSystemTools::RemoveFile(file2tmp.c_str()); cmSystemTools::RemoveFile(file3tmp.c_str()); } +#endif + +void ForceStringUse() +{ + std::vector<std::string> v; + std::vector<std::string> v2; + v = v2; + std::string cachetest = CACHE_TEST_VAR_INTERNAL; + v.push_back(cachetest); + v2 = v; + std::string x(5,'x'); + char buff[5]; + x.copy(buff, 1, 0); + x[0] = 'a'; + std::string::size_type pos = 0; + x.replace(pos, pos, pos, 'x'); + std::string copy = cachetest; + cachetest.find("bar"); + cachetest.rfind("bar"); + copy.append(cachetest); + copy = cachetest.substr(0, cachetest.size()); +} + + // defined in testcflags.c extern "C" int TestCFlags(char* m); @@ -273,6 +285,7 @@ int main() #endif std::string exe = lib; +#ifndef CMAKE_TEST_DIFFERENT_GENERATOR // Test a single character executable to test a: in makefiles exe += "A"; exe += cmSystemTools::GetExecutableExtension(); @@ -352,6 +365,20 @@ int main() cmPassed("Call to C sharedFunction from shared library worked."); } + // ---------------------------------------------------------------------- + // Test cmSystemTools::UpperCase + std::string str = "abc"; + std::string strupper = "ABC"; + if(cmSystemTools::UpperCase(str) == strupper) + { + cmPassed("cmSystemTools::UpperCase is working"); + } + else + { + cmFailed("cmSystemTools::UpperCase is working"); + } +#endif + if(file1() != 1) { cmFailed("Call to file1 function from library failed."); @@ -926,6 +953,7 @@ int main() } #endif +#ifndef CMAKE_TEST_DIFFERENT_GENERATOR // ---------------------------------------------------------------------- // Some pre-build/pre-link/post-build custom-commands have been // attached to the lib (see Library/). @@ -955,7 +983,7 @@ int main() // only created during a build. TestAndRemoveFile(BINARY_DIR "/Library/custom_target1.txt"); - + // ---------------------------------------------------------------------- // A directory has been created. @@ -971,6 +999,7 @@ int main() // only created during a build. TestAndRemoveFile(BINARY_DIR "/Executable/Temp/complex-required.txt"); +#endif // ---------------------------------------------------------------------- // Test FIND_LIBRARY @@ -1088,19 +1117,6 @@ int main() // ---------------------------------------------------------------------- - // Test cmSystemTools::UpperCase - std::string str = "abc"; - std::string strupper = "ABC"; - if(cmSystemTools::UpperCase(str) == strupper) - { - cmPassed("cmSystemTools::UpperCase is working"); - } - else - { - cmFailed("cmSystemTools::UpperCase is working"); - } - - // ---------------------------------------------------------------------- // Test if IF command inside a FOREACH works. #if defined(IF_INSIDE_FOREACH_THEN_EXECUTED) && !defined(IF_INSIDE_FOREACH_ELSE_EXECUTED) cmPassed("IF inside a FOREACH block works"); @@ -1135,6 +1151,7 @@ int main() cmPassed("CMake SET CACHE FORCE"); #endif +#ifndef CMAKE_TEST_DIFFERENT_GENERATOR // first run with shouldFail = true, this will // run with A B C as set by the CMakeList.txt file. if(!TestLibraryOrder(true)) @@ -1156,9 +1173,9 @@ int main() { cmFailed("CMake cmOrderLinkDirectories failed."); } - // Test the generated file stream. TestCMGeneratedFileSTream(); +#endif // ---------------------------------------------------------------------- // Summary diff --git a/Tests/Complex/cmTestConfigure.h.in b/Tests/Complex/cmTestConfigure.h.in index eadd2f0102..f2017abecf 100644 --- a/Tests/Complex/cmTestConfigure.h.in +++ b/Tests/Complex/cmTestConfigure.h.in @@ -4,6 +4,7 @@ #cmakedefine ONE_VAR_IS_DEFINED #cmakedefine ZERO_VAR +#cmakedefine CMAKE_TEST_DIFFERENT_GENERATOR #define STRING_VAR "${STRING_VAR}" // Test FOREACH diff --git a/Tests/ComplexOneConfig/Executable/CMakeLists.txt b/Tests/ComplexOneConfig/Executable/CMakeLists.txt index e3e11eac81..78ed5878ed 100644 --- a/Tests/ComplexOneConfig/Executable/CMakeLists.txt +++ b/Tests/ComplexOneConfig/Executable/CMakeLists.txt @@ -19,7 +19,10 @@ LINK_LIBRARIES(${COMPLEX_LIBS}) ADD_EXECUTABLE(A A.cxx) ADD_EXECUTABLE(complex complex testcflags.c) ADD_EXECUTABLE(complex.file complex.file.cxx) -TARGET_LINK_LIBRARIES(complex CMakeLib cmsys cmexpat cmzlib cmtar) +IF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) + TARGET_LINK_LIBRARIES(complex CMakeLib cmsys cmexpat cmzlib cmtar) +ENDIF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) + IF (UNIX) TARGET_LINK_LIBRARIES(complex ${CMAKE_DL_LIBS}) ELSE(UNIX) diff --git a/Tests/ComplexOneConfig/Executable/complex.cxx b/Tests/ComplexOneConfig/Executable/complex.cxx index 9fac9abefd..06af8ec974 100644 --- a/Tests/ComplexOneConfig/Executable/complex.cxx +++ b/Tests/ComplexOneConfig/Executable/complex.cxx @@ -8,19 +8,44 @@ extern "C" { #include "testConly.h" } +#ifndef CMAKE_TEST_DIFFERENT_GENERATOR #include "cmStandardIncludes.h" #include "cmSystemTools.h" #include "cmDynamicLoader.h" #include "cmSystemTools.h" #include "cmOrderLinkDirectories.h" #include "cmGeneratedFileStream.h" +#else +#include <vector> +#include <string> +#include <iostream> +#include <string.h> +#endif + int cm_passed = 0; int cm_failed = 0; +// ====================================================================== + +void cmFailed(const char* Message, const char* m2= "", const char* m3 = "") +{ + std::cout << "FAILED: " << Message << m2 << m3 << "\n"; + cm_failed++; +} + +// ====================================================================== + +void cmPassed(const char* Message, const char* m2="") +{ + std::cout << "Passed: " << Message << m2 << "\n"; + cm_passed++; +} #ifndef CMAKE_IS_REALLY_FUN This is a problem. Looks like ADD_DEFINITIONS and REMOVE_DEFINITIONS does not work #endif + +#ifndef CMAKE_TEST_DIFFERENT_GENERATOR // Here is a stupid function that tries to use std::string methods // so that the dec cxx compiler will instantiate the stuff that // we are using from the CMakeLib library.... @@ -99,43 +124,6 @@ bool TestLibraryOrder(bool shouldFail) return ret; } -void ForceStringUse() -{ - std::vector<std::string> v; - std::vector<std::string> v2; - v = v2; - std::string cachetest = CACHE_TEST_VAR_INTERNAL; - v.push_back(cachetest); - v2 = v; - std::string x(5,'x'); - char buff[5]; - x.copy(buff, 1, 0); - x[0] = 'a'; - std::string::size_type pos = 0; - x.replace(pos, pos, pos, 'x'); - std::string copy = cachetest; - cachetest.find("bar"); - cachetest.rfind("bar"); - copy.append(cachetest); - copy = cachetest.substr(0, cachetest.size()); -} - -// ====================================================================== - -void cmFailed(const char* Message, const char* m2= "", const char* m3 = "") -{ - std::cout << "FAILED: " << Message << m2 << m3 << "\n"; - cm_failed++; -} - -// ====================================================================== - -void cmPassed(const char* Message, const char* m2="") -{ - std::cout << "Passed: " << Message << m2 << "\n"; - cm_passed++; -} - // ====================================================================== void TestAndRemoveFile(const char* filename) @@ -258,6 +246,30 @@ void TestCMGeneratedFileSTream() cmSystemTools::RemoveFile(file2tmp.c_str()); cmSystemTools::RemoveFile(file3tmp.c_str()); } +#endif + +void ForceStringUse() +{ + std::vector<std::string> v; + std::vector<std::string> v2; + v = v2; + std::string cachetest = CACHE_TEST_VAR_INTERNAL; + v.push_back(cachetest); + v2 = v; + std::string x(5,'x'); + char buff[5]; + x.copy(buff, 1, 0); + x[0] = 'a'; + std::string::size_type pos = 0; + x.replace(pos, pos, pos, 'x'); + std::string copy = cachetest; + cachetest.find("bar"); + cachetest.rfind("bar"); + copy.append(cachetest); + copy = cachetest.substr(0, cachetest.size()); +} + + // defined in testcflags.c extern "C" int TestCFlags(char* m); @@ -273,6 +285,7 @@ int main() #endif std::string exe = lib; +#ifndef CMAKE_TEST_DIFFERENT_GENERATOR // Test a single character executable to test a: in makefiles exe += "A"; exe += cmSystemTools::GetExecutableExtension(); @@ -352,6 +365,20 @@ int main() cmPassed("Call to C sharedFunction from shared library worked."); } + // ---------------------------------------------------------------------- + // Test cmSystemTools::UpperCase + std::string str = "abc"; + std::string strupper = "ABC"; + if(cmSystemTools::UpperCase(str) == strupper) + { + cmPassed("cmSystemTools::UpperCase is working"); + } + else + { + cmFailed("cmSystemTools::UpperCase is working"); + } +#endif + if(file1() != 1) { cmFailed("Call to file1 function from library failed."); @@ -926,6 +953,7 @@ int main() } #endif +#ifndef CMAKE_TEST_DIFFERENT_GENERATOR // ---------------------------------------------------------------------- // Some pre-build/pre-link/post-build custom-commands have been // attached to the lib (see Library/). @@ -955,7 +983,7 @@ int main() // only created during a build. TestAndRemoveFile(BINARY_DIR "/Library/custom_target1.txt"); - + // ---------------------------------------------------------------------- // A directory has been created. @@ -971,6 +999,7 @@ int main() // only created during a build. TestAndRemoveFile(BINARY_DIR "/Executable/Temp/complex-required.txt"); +#endif // ---------------------------------------------------------------------- // Test FIND_LIBRARY @@ -1088,19 +1117,6 @@ int main() // ---------------------------------------------------------------------- - // Test cmSystemTools::UpperCase - std::string str = "abc"; - std::string strupper = "ABC"; - if(cmSystemTools::UpperCase(str) == strupper) - { - cmPassed("cmSystemTools::UpperCase is working"); - } - else - { - cmFailed("cmSystemTools::UpperCase is working"); - } - - // ---------------------------------------------------------------------- // Test if IF command inside a FOREACH works. #if defined(IF_INSIDE_FOREACH_THEN_EXECUTED) && !defined(IF_INSIDE_FOREACH_ELSE_EXECUTED) cmPassed("IF inside a FOREACH block works"); @@ -1135,6 +1151,7 @@ int main() cmPassed("CMake SET CACHE FORCE"); #endif +#ifndef CMAKE_TEST_DIFFERENT_GENERATOR // first run with shouldFail = true, this will // run with A B C as set by the CMakeList.txt file. if(!TestLibraryOrder(true)) @@ -1156,9 +1173,9 @@ int main() { cmFailed("CMake cmOrderLinkDirectories failed."); } - // Test the generated file stream. TestCMGeneratedFileSTream(); +#endif // ---------------------------------------------------------------------- // Summary diff --git a/Tests/ComplexOneConfig/cmTestConfigure.h.in b/Tests/ComplexOneConfig/cmTestConfigure.h.in index eadd2f0102..f2017abecf 100644 --- a/Tests/ComplexOneConfig/cmTestConfigure.h.in +++ b/Tests/ComplexOneConfig/cmTestConfigure.h.in @@ -4,6 +4,7 @@ #cmakedefine ONE_VAR_IS_DEFINED #cmakedefine ZERO_VAR +#cmakedefine CMAKE_TEST_DIFFERENT_GENERATOR #define STRING_VAR "${STRING_VAR}" // Test FOREACH diff --git a/Tests/ComplexRelativePaths/Executable/CMakeLists.txt b/Tests/ComplexRelativePaths/Executable/CMakeLists.txt index e3e11eac81..78ed5878ed 100644 --- a/Tests/ComplexRelativePaths/Executable/CMakeLists.txt +++ b/Tests/ComplexRelativePaths/Executable/CMakeLists.txt @@ -19,7 +19,10 @@ LINK_LIBRARIES(${COMPLEX_LIBS}) ADD_EXECUTABLE(A A.cxx) ADD_EXECUTABLE(complex complex testcflags.c) ADD_EXECUTABLE(complex.file complex.file.cxx) -TARGET_LINK_LIBRARIES(complex CMakeLib cmsys cmexpat cmzlib cmtar) +IF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) + TARGET_LINK_LIBRARIES(complex CMakeLib cmsys cmexpat cmzlib cmtar) +ENDIF(NOT CMAKE_TEST_DIFFERENT_GENERATOR) + IF (UNIX) TARGET_LINK_LIBRARIES(complex ${CMAKE_DL_LIBS}) ELSE(UNIX) diff --git a/Tests/ComplexRelativePaths/Executable/complex.cxx b/Tests/ComplexRelativePaths/Executable/complex.cxx index 9fac9abefd..06af8ec974 100644 --- a/Tests/ComplexRelativePaths/Executable/complex.cxx +++ b/Tests/ComplexRelativePaths/Executable/complex.cxx @@ -8,19 +8,44 @@ extern "C" { #include "testConly.h" } +#ifndef CMAKE_TEST_DIFFERENT_GENERATOR #include "cmStandardIncludes.h" #include "cmSystemTools.h" #include "cmDynamicLoader.h" #include "cmSystemTools.h" #include "cmOrderLinkDirectories.h" #include "cmGeneratedFileStream.h" +#else +#include <vector> +#include <string> +#include <iostream> +#include <string.h> +#endif + int cm_passed = 0; int cm_failed = 0; +// ====================================================================== + +void cmFailed(const char* Message, const char* m2= "", const char* m3 = "") +{ + std::cout << "FAILED: " << Message << m2 << m3 << "\n"; + cm_failed++; +} + +// ====================================================================== + +void cmPassed(const char* Message, const char* m2="") +{ + std::cout << "Passed: " << Message << m2 << "\n"; + cm_passed++; +} #ifndef CMAKE_IS_REALLY_FUN This is a problem. Looks like ADD_DEFINITIONS and REMOVE_DEFINITIONS does not work #endif + +#ifndef CMAKE_TEST_DIFFERENT_GENERATOR // Here is a stupid function that tries to use std::string methods // so that the dec cxx compiler will instantiate the stuff that // we are using from the CMakeLib library.... @@ -99,43 +124,6 @@ bool TestLibraryOrder(bool shouldFail) return ret; } -void ForceStringUse() -{ - std::vector<std::string> v; - std::vector<std::string> v2; - v = v2; - std::string cachetest = CACHE_TEST_VAR_INTERNAL; - v.push_back(cachetest); - v2 = v; - std::string x(5,'x'); - char buff[5]; - x.copy(buff, 1, 0); - x[0] = 'a'; - std::string::size_type pos = 0; - x.replace(pos, pos, pos, 'x'); - std::string copy = cachetest; - cachetest.find("bar"); - cachetest.rfind("bar"); - copy.append(cachetest); - copy = cachetest.substr(0, cachetest.size()); -} - -// ====================================================================== - -void cmFailed(const char* Message, const char* m2= "", const char* m3 = "") -{ - std::cout << "FAILED: " << Message << m2 << m3 << "\n"; - cm_failed++; -} - -// ====================================================================== - -void cmPassed(const char* Message, const char* m2="") -{ - std::cout << "Passed: " << Message << m2 << "\n"; - cm_passed++; -} - // ====================================================================== void TestAndRemoveFile(const char* filename) @@ -258,6 +246,30 @@ void TestCMGeneratedFileSTream() cmSystemTools::RemoveFile(file2tmp.c_str()); cmSystemTools::RemoveFile(file3tmp.c_str()); } +#endif + +void ForceStringUse() +{ + std::vector<std::string> v; + std::vector<std::string> v2; + v = v2; + std::string cachetest = CACHE_TEST_VAR_INTERNAL; + v.push_back(cachetest); + v2 = v; + std::string x(5,'x'); + char buff[5]; + x.copy(buff, 1, 0); + x[0] = 'a'; + std::string::size_type pos = 0; + x.replace(pos, pos, pos, 'x'); + std::string copy = cachetest; + cachetest.find("bar"); + cachetest.rfind("bar"); + copy.append(cachetest); + copy = cachetest.substr(0, cachetest.size()); +} + + // defined in testcflags.c extern "C" int TestCFlags(char* m); @@ -273,6 +285,7 @@ int main() #endif std::string exe = lib; +#ifndef CMAKE_TEST_DIFFERENT_GENERATOR // Test a single character executable to test a: in makefiles exe += "A"; exe += cmSystemTools::GetExecutableExtension(); @@ -352,6 +365,20 @@ int main() cmPassed("Call to C sharedFunction from shared library worked."); } + // ---------------------------------------------------------------------- + // Test cmSystemTools::UpperCase + std::string str = "abc"; + std::string strupper = "ABC"; + if(cmSystemTools::UpperCase(str) == strupper) + { + cmPassed("cmSystemTools::UpperCase is working"); + } + else + { + cmFailed("cmSystemTools::UpperCase is working"); + } +#endif + if(file1() != 1) { cmFailed("Call to file1 function from library failed."); @@ -926,6 +953,7 @@ int main() } #endif +#ifndef CMAKE_TEST_DIFFERENT_GENERATOR // ---------------------------------------------------------------------- // Some pre-build/pre-link/post-build custom-commands have been // attached to the lib (see Library/). @@ -955,7 +983,7 @@ int main() // only created during a build. TestAndRemoveFile(BINARY_DIR "/Library/custom_target1.txt"); - + // ---------------------------------------------------------------------- // A directory has been created. @@ -971,6 +999,7 @@ int main() // only created during a build. TestAndRemoveFile(BINARY_DIR "/Executable/Temp/complex-required.txt"); +#endif // ---------------------------------------------------------------------- // Test FIND_LIBRARY @@ -1088,19 +1117,6 @@ int main() // ---------------------------------------------------------------------- - // Test cmSystemTools::UpperCase - std::string str = "abc"; - std::string strupper = "ABC"; - if(cmSystemTools::UpperCase(str) == strupper) - { - cmPassed("cmSystemTools::UpperCase is working"); - } - else - { - cmFailed("cmSystemTools::UpperCase is working"); - } - - // ---------------------------------------------------------------------- // Test if IF command inside a FOREACH works. #if defined(IF_INSIDE_FOREACH_THEN_EXECUTED) && !defined(IF_INSIDE_FOREACH_ELSE_EXECUTED) cmPassed("IF inside a FOREACH block works"); @@ -1135,6 +1151,7 @@ int main() cmPassed("CMake SET CACHE FORCE"); #endif +#ifndef CMAKE_TEST_DIFFERENT_GENERATOR // first run with shouldFail = true, this will // run with A B C as set by the CMakeList.txt file. if(!TestLibraryOrder(true)) @@ -1156,9 +1173,9 @@ int main() { cmFailed("CMake cmOrderLinkDirectories failed."); } - // Test the generated file stream. TestCMGeneratedFileSTream(); +#endif // ---------------------------------------------------------------------- // Summary diff --git a/Tests/ComplexRelativePaths/cmTestConfigure.h.in b/Tests/ComplexRelativePaths/cmTestConfigure.h.in index eadd2f0102..f2017abecf 100644 --- a/Tests/ComplexRelativePaths/cmTestConfigure.h.in +++ b/Tests/ComplexRelativePaths/cmTestConfigure.h.in @@ -4,6 +4,7 @@ #cmakedefine ONE_VAR_IS_DEFINED #cmakedefine ZERO_VAR +#cmakedefine CMAKE_TEST_DIFFERENT_GENERATOR #define STRING_VAR "${STRING_VAR}" // Test FOREACH diff --git a/Tests/LoadCommand/CMakeCommands/CMakeLists.txt b/Tests/LoadCommand/CMakeCommands/CMakeLists.txt index c5112c7f79..55b6b8beec 100644 --- a/Tests/LoadCommand/CMakeCommands/CMakeLists.txt +++ b/Tests/LoadCommand/CMakeCommands/CMakeLists.txt @@ -6,8 +6,13 @@ ENDIF (MUDSLIDE_TYPE MATCHES MUCHO) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_ANSI_CXXFLAGS}") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}") - +IF(WATCOM) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") +ENDIF(WATCOM) INCLUDE_DIRECTORIES(${CMAKE_ROOT}/include ${CMAKE_ROOT}/Source) ADD_LIBRARY(cmCMAKE_TEST_COMMAND MODULE cmTestCommand.c) +IF(WATCOM) + TARGET_LINK_LIBRARIES(cmCMAKE_TEST_COMMAND clbsdll.lib) +ENDIF(WATCOM) diff --git a/Tests/LoadCommand/CMakeCommands/cmTestCommand.c b/Tests/LoadCommand/CMakeCommands/cmTestCommand.c index 5ca9b336c6..bd36b5c21f 100644 --- a/Tests/LoadCommand/CMakeCommands/cmTestCommand.c +++ b/Tests/LoadCommand/CMakeCommands/cmTestCommand.c @@ -10,9 +10,8 @@ typedef struct char** Argv; } cmVTKWrapTclData; - /* do almost everything in the initial pass */ -static int InitialPass(void *inf, void *mf, int argc, char *argv[]) +static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[]) { char* file; char* str; @@ -134,7 +133,7 @@ static int InitialPass(void *inf, void *mf, int argc, char *argv[]) return 1; } -static void FinalPass(void *inf, void *mf) +static void CCONV FinalPass(void *inf, void *mf) { cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf; /* get our client data from initial pass */ @@ -146,8 +145,7 @@ static void FinalPass(void *inf, void *mf) fprintf(stderr,"*** Failed LOADED COMMAND Final Pass\n"); } } - -static void Destructor(void *inf) +static void CCONV Destructor(void *inf) { cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf; /* get our client data from initial pass */ @@ -157,7 +155,7 @@ static void Destructor(void *inf) } #ifdef MUCHO_MUDSLIDE -void CM_PLUGIN_EXPORT CMAKE_TEST_COMMANDInit(cmLoadedCommandInfo *info) +void CM_PLUGIN_EXPORT CCONV CMAKE_TEST_COMMANDInit(cmLoadedCommandInfo *info) { info->InitialPass = InitialPass; info->FinalPass = FinalPass; diff --git a/Tests/LoadCommandOneConfig/CMakeCommands/CMakeLists.txt b/Tests/LoadCommandOneConfig/CMakeCommands/CMakeLists.txt index c5112c7f79..55b6b8beec 100644 --- a/Tests/LoadCommandOneConfig/CMakeCommands/CMakeLists.txt +++ b/Tests/LoadCommandOneConfig/CMakeCommands/CMakeLists.txt @@ -6,8 +6,13 @@ ENDIF (MUDSLIDE_TYPE MATCHES MUCHO) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_ANSI_CXXFLAGS}") SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_ANSI_CFLAGS}") - +IF(WATCOM) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") +ENDIF(WATCOM) INCLUDE_DIRECTORIES(${CMAKE_ROOT}/include ${CMAKE_ROOT}/Source) ADD_LIBRARY(cmCMAKE_TEST_COMMAND MODULE cmTestCommand.c) +IF(WATCOM) + TARGET_LINK_LIBRARIES(cmCMAKE_TEST_COMMAND clbsdll.lib) +ENDIF(WATCOM) diff --git a/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c b/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c index 5ca9b336c6..bd36b5c21f 100644 --- a/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c +++ b/Tests/LoadCommandOneConfig/CMakeCommands/cmTestCommand.c @@ -10,9 +10,8 @@ typedef struct char** Argv; } cmVTKWrapTclData; - /* do almost everything in the initial pass */ -static int InitialPass(void *inf, void *mf, int argc, char *argv[]) +static int CCONV InitialPass(void *inf, void *mf, int argc, char *argv[]) { char* file; char* str; @@ -134,7 +133,7 @@ static int InitialPass(void *inf, void *mf, int argc, char *argv[]) return 1; } -static void FinalPass(void *inf, void *mf) +static void CCONV FinalPass(void *inf, void *mf) { cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf; /* get our client data from initial pass */ @@ -146,8 +145,7 @@ static void FinalPass(void *inf, void *mf) fprintf(stderr,"*** Failed LOADED COMMAND Final Pass\n"); } } - -static void Destructor(void *inf) +static void CCONV Destructor(void *inf) { cmLoadedCommandInfo *info = (cmLoadedCommandInfo *)inf; /* get our client data from initial pass */ @@ -157,7 +155,7 @@ static void Destructor(void *inf) } #ifdef MUCHO_MUDSLIDE -void CM_PLUGIN_EXPORT CMAKE_TEST_COMMANDInit(cmLoadedCommandInfo *info) +void CM_PLUGIN_EXPORT CCONV CMAKE_TEST_COMMANDInit(cmLoadedCommandInfo *info) { info->InitialPass = InitialPass; info->FinalPass = FinalPass; diff --git a/Tests/SubDir/AnotherSubdir/pair_int.int.c b/Tests/SubDir/AnotherSubdir/pair_int.int.c new file mode 100644 index 0000000000..b7a6237818 --- /dev/null +++ b/Tests/SubDir/AnotherSubdir/pair_int.int.c @@ -0,0 +1,6 @@ +#include <stdio.h> + +void pair_stuff() +{ + printf("Placeholder for a strange file in subdirectory\n"); +} diff --git a/Tests/SubDir/CMakeLists.txt b/Tests/SubDir/CMakeLists.txt index 5cf885945b..b0f9f62524 100644 --- a/Tests/SubDir/CMakeLists.txt +++ b/Tests/SubDir/CMakeLists.txt @@ -1,16 +1,45 @@ PROJECT(SUBDIR) SUBDIRS(Executable EXCLUDE_FROM_ALL Examples) WRITE_FILE(${SUBDIR_BINARY_DIR}/ShouldBeHere "This file should exist.") +#WATCOM WMAKE does not support + in the name of a file! +IF(WATCOM) + SET(PLUS_NAME_FILES + AnotherSubdir/pair_int.int.c + vcl_algorithm_vcl_pair_double.foo.c) +ELSE(WATCOM) + SET(PLUS_NAME_FILES + AnotherSubdir/pair+int.int.c + vcl_algorithm+vcl_pair+double.foo.c) +ENDIF(WATCOM) ADD_EXECUTABLE(TestFromSubdir AnotherSubdir/testfromsubdir.c AnotherSubdir/secondone - AnotherSubdir/pair+int.int.c - vcl_algorithm+vcl_pair+double.foo.c + ${PLUS_NAME_FILES} ) AUX_SOURCE_DIRECTORY(ThirdSubDir SOURCES) -SET(SOURCES ${SOURCES} - vcl_algorithm+vcl_pair+double.foo.c) +IF(WATCOM) + FOREACH(f ${SOURCES}) + IF("${f}" STREQUAL "ThirdSubDir/pair+int.int1.c") + ELSE("${f}" STREQUAL "ThirdSubDir/pair+int.int1.c") + SET(SOURCES2 ${f} ${SOURCES2}) + ENDIF("${f}" STREQUAL "ThirdSubDir/pair+int.int1.c") + ENDFOREACH(f) + SET(SOURCES ${SOURCES2}) + SET(SOURCES ${SOURCES} + vcl_algorithm_vcl_pair_double.foo.c) +ELSE(WATCOM) + FOREACH(f ${SOURCES}) + IF("${f}" STREQUAL "ThirdSubDir/pair_int.int1.c") + ELSE("${f}" STREQUAL "ThirdSubDir/pair_int.int1.c") + SET(SOURCES2 ${f} ${SOURCES2}) + MESSAGE("${f}") + ENDIF("${f}" STREQUAL "ThirdSubDir/pair_int.int1.c") + ENDFOREACH(f) + SET(SOURCES ${SOURCES2}) + SET(SOURCES ${SOURCES} + vcl_algorithm+vcl_pair+double.foo.c) +ENDIF(WATCOM) MESSAGE("Sources: ${SOURCES}") ADD_EXECUTABLE(TestWithAuxSourceDir ${SOURCES}) diff --git a/Tests/SubDir/ThirdSubDir/pair_int.int1.c b/Tests/SubDir/ThirdSubDir/pair_int.int1.c new file mode 100644 index 0000000000..b7a6237818 --- /dev/null +++ b/Tests/SubDir/ThirdSubDir/pair_int.int1.c @@ -0,0 +1,6 @@ +#include <stdio.h> + +void pair_stuff() +{ + printf("Placeholder for a strange file in subdirectory\n"); +} diff --git a/Tests/SubDir/vcl_algorithm_vcl_pair_double.foo.c b/Tests/SubDir/vcl_algorithm_vcl_pair_double.foo.c new file mode 100644 index 0000000000..a0c60f75aa --- /dev/null +++ b/Tests/SubDir/vcl_algorithm_vcl_pair_double.foo.c @@ -0,0 +1,6 @@ +#include <stdio.h> + +void vcl_stuff() +{ + printf("Placeholder for a file with strange name\n"); +} diff --git a/Utilities/cmcurl/CMake/CheckTypeSize.c.in b/Utilities/cmcurl/CMake/CheckTypeSize.c.in index 822d9c5e62..8c9a0163e5 100644 --- a/Utilities/cmcurl/CMake/CheckTypeSize.c.in +++ b/Utilities/cmcurl/CMake/CheckTypeSize.c.in @@ -1,7 +1,7 @@ +#cmakedefine CHECK_TYPE_SIZE_TYPE @CHECK_TYPE_SIZE_TYPE@ #ifdef CHECK_TYPE_SIZE_TYPE @CHECK_TYPE_SIZE_PREINCLUDE@ - #ifdef HAVE_SYS_TYPES_H # include <sys/types.h> #endif /* HAVE_SYS_TYPES_H */ diff --git a/Utilities/cmcurl/CMake/CheckTypeSize.cmake b/Utilities/cmcurl/CMake/CheckTypeSize.cmake index 26c822da2c..be76154168 100644 --- a/Utilities/cmcurl/CMake/CheckTypeSize.cmake +++ b/Utilities/cmcurl/CMake/CheckTypeSize.cmake @@ -1,28 +1,28 @@ -# +# - Check sizeof a type +# CHECK_TYPE_SIZE(TYPE VARIABLE) # Check if the type exists and determine size of type. if the type # exists, the size will be stored to the variable. # -# CHECK_TYPE_SIZE - macro which checks the size of type -# VARIABLE - variable to store size if the type exists. -# HAVE_${VARIABLE} - does the variable exists or not -# +# VARIABLE - variable to store size if the type exists. +# HAVE_${VARIABLE} - does the variable exists or not MACRO(CHECK_TYPE_SIZE TYPE VARIABLE) SET(CMAKE_ALLOW_UNKNOWN_VARIABLE_READ_ACCESS 1) IF("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$") + SET(CHECK_TYPE_SIZE_TYPE "${TYPE}") SET(MACRO_CHECK_TYPE_SIZE_FLAGS - "-DCHECK_TYPE_SIZE_TYPE=\"${TYPE}\" ${CMAKE_REQUIRED_FLAGS}") + "${CMAKE_REQUIRED_FLAGS}") FOREACH(def HAVE_SYS_TYPES_H HAVE_STDINT_H HAVE_STDDEF_H) IF("${def}") SET(MACRO_CHECK_TYPE_SIZE_FLAGS "${MACRO_CHECK_TYPE_SIZE_FLAGS} -D${def}") ENDIF("${def}") ENDFOREACH(def) - SET(CHECK_TYPE_SIZE_PREMAIN) + SET(CHECK_TYPE_SIZE_PREINCLUDE) FOREACH(def ${CMAKE_EXTRA_INCLUDE_FILES}) SET(CHECK_TYPE_SIZE_PREMAIN "${CHECK_TYPE_SIZE_PREMAIN}#include \"${def}\"\n") ENDFOREACH(def) - CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/CMake/CheckTypeSize.c.in" + CONFIGURE_FILE("${CMAKE_ROOT}/Modules/CheckTypeSize.c.in" "${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckTypeSize.c" IMMEDIATE @ONLY) FILE(READ "${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/CheckTypeSize.c" CHECK_TYPE_SIZE_FILE_CONTENT) @@ -39,11 +39,11 @@ MACRO(CHECK_TYPE_SIZE TYPE VARIABLE) OUTPUT_VARIABLE OUTPUT) IF(HAVE_${VARIABLE}) MESSAGE(STATUS "Check size of ${TYPE} - done") - FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeOutput.log + FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeOutput.log "Determining size of ${TYPE} passed with the following output:\n${OUTPUT}\n\n") ELSE(HAVE_${VARIABLE}) MESSAGE(STATUS "Check size of ${TYPE} - failed") - FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeError.log + FILE(APPEND ${CMAKE_BINARY_DIR}/CMakeFiles/CMakeError.log "Determining size of ${TYPE} failed with the following output:\n${OUTPUT}\nCheckTypeSize.c:\n${CHECK_TYPE_SIZE_FILE_CONTENT}\n\n") ENDIF(HAVE_${VARIABLE}) ENDIF("HAVE_${VARIABLE}" MATCHES "^HAVE_${VARIABLE}$") diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt index f2367e497c..b6152420e3 100644 --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt @@ -252,7 +252,6 @@ CHECK_INCLUDE_FILE_CONCAT("setjmp.h" HAVE_SETJMP_H) CHECK_INCLUDE_FILE_CONCAT("signal.h" HAVE_SIGNAL_H) CHECK_INCLUDE_FILE_CONCAT("sys/ioctl.h" HAVE_SYS_IOCTL_H) CHECK_INCLUDE_FILE_CONCAT("sys/utsname.h" HAVE_SYS_UTSNAME_H) - CHECK_TYPE_SIZE(size_t SIZEOF_SIZE_T) CHECK_TYPE_SIZE(ssize_t SIZEOF_SSIZE_T) CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG) diff --git a/Utilities/cmcurl/Platforms/WindowsCache.cmake b/Utilities/cmcurl/Platforms/WindowsCache.cmake index 1a84b37784..d660c0a771 100644 --- a/Utilities/cmcurl/Platforms/WindowsCache.cmake +++ b/Utilities/cmcurl/Platforms/WindowsCache.cmake @@ -51,7 +51,6 @@ IF(NOT UNIX) SET(HAVE_ZLIB_H 0) SET(HAVE_SIZEOF_LONG_DOUBLE 1) - SET(HAVE_SIZEOF_SSIZE_T 0) SET(SIZEOF_LONG_DOUBLE 8) SET(HAVE_SOCKET 1) diff --git a/Utilities/cmcurl/timeval.h b/Utilities/cmcurl/timeval.h index 67b885ac6a..efe377e0d8 100644 --- a/Utilities/cmcurl/timeval.h +++ b/Utilities/cmcurl/timeval.h @@ -37,7 +37,7 @@ #endif #ifndef HAVE_GETTIMEOFDAY -#if !defined(_WINSOCKAPI_) && !defined(__MINGW32__) && !defined(_AMIGASF) && \ +#if !defined(_WINSOCKAPI_) && !defined(__WATCOMC__) && !defined(__MINGW32__) && !defined(_AMIGASF) && \ !defined(__LCC__) struct timeval { long tv_sec; diff --git a/Utilities/cmtar/handle.c b/Utilities/cmtar/handle.c index 4b9a169d8e..de324cb247 100644 --- a/Utilities/cmtar/handle.c +++ b/Utilities/cmtar/handle.c @@ -24,7 +24,7 @@ # include <stdlib.h> #endif -#ifdef _MSC_VER +#if defined ( _MSC_VER) || defined(__WATCOMC__) #include <io.h> //Yogi: hack. this should work on windows where there is no O_ACCMODE defined #ifndef O_ACCMODE diff --git a/Utilities/cmtar/libtar.c b/Utilities/cmtar/libtar.c index 9131512d9f..fdeccf21b9 100644 --- a/Utilities/cmtar/libtar.c +++ b/Utilities/cmtar/libtar.c @@ -75,6 +75,13 @@ struct gzStruct gzFile* GZFile; }; struct gzStruct GZStruct; +#if defined ( _MSC_VER) || defined(__WATCOMC__) +#include <io.h> +//Yogi: hack. this should work on windows where there is no O_ACCMODE defined +#ifndef O_ACCMODE +# define O_ACCMODE 0x0003 +#endif +#endif int libtar_gzopen(void* call_data, const char *pathname, int oflags, mode_t mode) { |