[CMake] CMake on OpenVMS - Apparent roadblock buried within cmake-3.3.2\Tests\CMakeLists.txt
Custin, Jay (CSC Sw Middleware)
jay.custin at hpe.com
Fri Oct 30 11:18:24 EDT 2015
Q: What makes you think there is a problem in Tests/CMakeLists.txt?
A: Certainly the "problem" could exist in any of the myriad of files that get processed as a result of the Tests/CMakeLists.txt file, but I base my hypothesis on the following MESSAGE statements which I added to the main CMakeLists.txt file:
MESSAGE( STATUS "CMAKELISTS.TXT Marker 17 add_subdirectory(Tests)" )
add_subdirectory(Tests)
MESSAGE( STATUS "CMAKELISTS.TXT Marker 18")
And when I execute the configure script (or manually execute the equivalent CMake execution at the tail end of the bootstrap) I see the following:
-- Marker 16g add_subdirectory(Utilities)
-- CMAKELISTS.TXT Marker 17 add_subdirectory(Tests)
-- if(DEFINED ENV{HOME} AND NOT CTEST_NO_TEST_HOME) ==> TRUE
<<CUT>
And NEVER see the "CMAKELISTS.TXT Marker 18") appear in the output... so it "enters" the statement:
add_subdirectory(Tests)
on a "one-way ticket" (meaning it appears to never return to the parsing/calling CMakeLists.txt file)
> Does anyone know where (specifically) I should investigate to
> determine where the Makefile itself should get generated?
>
What files are generated in the build tree?
For the moment skipping this question in lieu of pursuing your suggestion of the results of using the bootstrapped CMake to configure a simple project further (below)
The toplevel makefile is created here:
void cmGlobalUnixMakefileGenerator3::WriteMainCMakefile()
But there are lots of other files that get created.
One thing you could try is to use the bootstrapped cmake to configure a more simple project. Something like:
project(foo)
add_library(foo foo.c)
foo.c can be an empty file.
Does the bootstrapped cmake work on that project?
Initially I feared that I would have to answer "No", but after some further excavation I did make some significant progress (which probably also reveals some things that still, not surprisingly, need more tweaking).
ITAN1* cmake "-DCMAKE_BOOTSTRAP=1"
CMake Error: Error in cmake code at
/JAY/CMAKE/CMakeLists.txt:1:
Parse error. Expected a newline, got identifier with text "add_library".
-- Configuring incomplete, errors occurred!
ITAN1* d
Directory JAY:[cmake]
CMakeCache.txt;1 CMakeFiles.DIR;1 cmakelists.txt;5 foo.c;1
After beating my head on the desk for a while... I finally decided to beat the cmakelists.txt file instead (force the file structure on the file - thank you OpenVMS for defaulting to CRLF) and after that I managed to get the following result:
ITAN1* ty *.*
JAY:[cmake]cmakelists.txt;10
project(foo)
add_library(foo foo.c)
JAY:[cmake]foo.c;3
#include<stdio.h>
main()
{
printf("Hello World");
}
ITAN1*
I did try my level-headed best to get this to work from the OpenVMS DCL prompt directly, but (at the moment) without success. That said... from the GNV Bash prompt I did (with some additional switch definitions) get it to generate the Makefile:
So taking my simple "hello world" project files and copying them to a clean directory:
ITAN1* create/dir jay:[cmake_simple_test]
ITAN1* copy foo.c,cmakelists.txt jay:[cmake_simple_test]/log
%COPY-S-COPIED, JAY:[cmake]foo.c;3 copied to JAY:[cmake_simple_test]foo.c;3 (1 block)
%COPY-S-COPIED, JAY:[cmake]cmakelists.txt;10 copied to JAY:[cmake_simple_test]cmakelists.txt;10 (1 block)
%COPY-S-NEWFILES, 2 files created
ITAN1* set default jay:[cmake_simple_test]
JAY:[CMAKE_SIMPLE_TEST]
ITAN1* dir
Directory JAY:[cmake_simple_test]
cmakelists.txt;10 foo.c;3
Total of 2 files.
And switching to the GNV Bash shell it ran (in MY opinion) very cleanly, though I did ultimately determine that I had to manually define the CMAKE_C_COMPILER variable in the command line):
ITAN1* bash
bash-4.3$ /PRJ_ROOT/CMAKE-3_3_2/BOOTSTRAP_CMK/CMAKE -DCMAKE_BOOTSTRAP=1 -DCMAKE_C_COMPILER=/bin/cc
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Check for working C compiler: /bin/cc
-- Check for working C compiler: /bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /bin/CC
-- Check for working CXX compiler: /bin/CC -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: /JAY/CMAKE_SIMPLE_TEST
bash-4.3$ ls
CMakeCache.txt CMakeFiles Makefile cmake_install.cmake cmakelists.txt foo.c
Dropping back to the DCL prompt you can see it has created quie a few files:
ITAN1* dir [...]
Directory JAY:[cmake_simple_test]
CMakeCache.txt;1 CMakeFiles.DIR;1 cmakelists.txt;10 cmake_install.cmake;1
foo.c;3 Makefile.;1
Total of 6 files.
Directory JAY:[cmake_simple_test.CMakeFiles]
3^.3^.2.DIR;1 cmake.check_cache;2 cmake.check_cache;1 CMakeDirectoryInformation.cmake;1
CMakeError.log;1 CMakeOutput.log;1 CMakeTmp.DIR;1 foo_dir.DIR;1
Makefile.cmake;1 Makefile2.;1 progress.marks;1 TargetDirectories.txt;1
Total of 12 files.
Directory JAY:[cmake_simple_test.CMakeFiles.3^.3^.2]
CMakeCCompiler.cmake;1 CMakeCXXCompiler.cmake;1
CMakeDetermineCompilerABI_C.bin;1 CMakeDetermineCompilerABI_CXX.bin;1
CMakeSystem.cmake;1 CompilerIdC.DIR;1 CompilerIdCXX.DIR;1
Total of 7 files.
Directory JAY:[cmake_simple_test.CMakeFiles.3^.3^.2.CompilerIdC]
cc_temp9dedd1.;1 cc_temp9df5d2.;1 CMakeCCompilerId.c;1
Total of 3 files.
Directory JAY:[cmake_simple_test.CMakeFiles.3^.3^.2.CompilerIdCXX]
cc_temp9df5d5.;1 cc_temp9dfdd7.;1 CMakeCXXCompilerId.cpp;1
Total of 3 files.
Directory JAY:[cmake_simple_test.CMakeFiles.foo_dir]
build.make;1 cmake_clean.cmake;1 cmake_clean_target.cmake;1
depend.make;1 DependInfo.cmake;1 flags.make;1 progress.make;1
Total of 7 files.
Grand total of 6 directories, 38 files.
Switching, yet again, back to the GNV Bash shell, the makefile does process without HORRIBLE errors, but the make does only create the file libfoo.a:
ITAN1* bash
bash-4.3$ make
Scanning dependencies of target foo
[-50%] Building C object CMakeFiles/foo_dir/foo.c.o
[ 0%] Linking C static library libfoo.a
[ 0%] Built target foo
bash-4.3$ ls
CMakeCache.txt CMakeFiles Makefile cmake_install.cmake cmakelists.txt foo.c libfoo.a
I wanted to send this reply back now, but will do some further investigation into the "real" build... Among the things I will try:
Interrupting/preventing the automatic execution of the bootstrapped CMake in the end of the bootstrap script and then try to execute it from the shell prompt using the same basic switches I used for the "simple" project above.
JayC
More information about the CMake
mailing list