Discussion:
[CMake] Digital Mars
Amitha Perera
2006-05-17 17:41:52 UTC
Permalink
Has anyone tried CMake with Digital Mars C/C++? My quick attempt with
CMake 2.2 and CMake 2.4.2 failed. Current error output with CMake 2.4.2 is

Determining if the C compiler works failed with the following output:
f CMakeFiles/cmTryCompileExec.dir/build.make CMakeFiles/cmTryCompileExec.dir/build
Error: 'f' not found

I set
CC=c:/dm/bin/dmc.exe
CXX=c:/dm/bin/dmc.exe
and used the Unix Makefile generator.

Thanks,
Amitha.
William A. Hoffman
2006-05-17 18:04:30 UTC
Permalink
Post by Amitha Perera
Has anyone tried CMake with Digital Mars C/C++? My quick attempt with
CMake 2.2 and CMake 2.4.2 failed. Current error output with CMake 2.4.2 is
f CMakeFiles/cmTryCompileExec.dir/build.make CMakeFiles/cmTryCompileExec.dir/build
Error: 'f' not found
I set
CC=c:/dm/bin/dmc.exe
CXX=c:/dm/bin/dmc.exe
and used the Unix Makefile generator.
You could run cmake --debug-trycompile and it will leave the makefiles around,
and you can run make in CMakeFiles/CMakeTmp to see what the error really is.
Does Digital Mars have its own make?

-Bill
Cristian Adam
2006-05-17 19:12:11 UTC
Permalink
Post by William A. Hoffman
You could run cmake --debug-trycompile and it will leave the makefiles around,
and you can run make in CMakeFiles/CMakeTmp to see what the error really is.
Does Digital Mars have its own make?
Yes it has. "Digital Mars Make Version 5.05"

Cristi.
William A. Hoffman
2006-05-17 19:43:40 UTC
Permalink
Post by Cristian Adam
Post by William A. Hoffman
You could run cmake --debug-trycompile and it will leave the makefiles around,
and you can run make in CMakeFiles/CMakeTmp to see what the error really is.
Does Digital Mars have its own make?
Yes it has. "Digital Mars Make Version 5.05"
In that case, I would suggest creating a generator similar to what I just did
for watcom.

-Bill
Amitha Perera
2006-05-18 14:18:46 UTC
Permalink
I've been able to get relatively far by simply implementing a
Platform/Windows-bmc.cmake, and using NMake as the Makefile parser. I
thought I'd try this first before writing a generator for the Digital
Mars make.

Right now, I'm stuck here: the Digital Mars linker wants full paths to
the libraries, or else will scan the LIB environment variable. Is
there a variable simliar to <LINK_LIBRARIES> that will expand to the
full paths of the required libraries?

(Unfortunately, this is somewhat low priority for me, so I'll
apologize in advance for delayed responses.)

Amitha.
William A. Hoffman
2006-05-18 15:51:17 UTC
Permalink
Post by Amitha Perera
I've been able to get relatively far by simply implementing a
Platform/Windows-bmc.cmake, and using NMake as the Makefile parser. I
thought I'd try this first before writing a generator for the Digital
Mars make.
Right now, I'm stuck here: the Digital Mars linker wants full paths to
the libraries, or else will scan the LIB environment variable. Is
there a variable simliar to <LINK_LIBRARIES> that will expand to the
full paths of the required libraries?
(Unfortunately, this is somewhat low priority for me, so I'll
apologize in advance for delayed responses.)
Currently, there is not.

It does seem that the linker can not add paths to the link line:

http://www.digitalmars.com/d/archives/c++/command-line/639.html

I am not even sure we always have that information. For example,
someone might do LINK_DIRECTORIES(....) LINK_LIBRARIES(A).

Maybe we could set the LIB env as part of the link command.
Then use the /SCANLIB option. Then do something like this:

In Windows-bmc.cmake try this:

SET(CMAKE_LIBRARY_PATH_FLAG ";")
SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
"set LIB=<LINK_LIBRARIES>"
"link ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out:<TARGET> /PDB:<TARGET_PDB> /dll <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")

We might need to create a <LINK_DIRECTORIES> that would only have the link directories
part of the link line, but that might work with the extra junk at the end of the lib path.

-Bill
Amitha Perera
2006-05-19 14:44:29 UTC
Permalink
Post by William A. Hoffman
I am not even sure we always have that information. For example,
someone might do LINK_DIRECTORIES(....) LINK_LIBRARIES(A).
In principle, CMake has enough knowledge to look for it by scanning
the current LINK_DIRECTORIES for libA.
Post by William A. Hoffman
Maybe we could set the LIB env as part of the link command.
SET(CMAKE_LIBRARY_PATH_FLAG ";")
SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
"set LIB=<LINK_LIBRARIES>"
"link ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out:<TARGET> /PDB:<TARGET_PDB> /dll <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
I tried this before my previous post, and it didn't work. The problem
is that the directory still appears on the command line, and it is
interpreted as a library.
Post by William A. Hoffman
We might need to create a <LINK_DIRECTORIES> that would only have
the link directories part of the link line, but that might work with
the extra junk at the end of the lib path.
I think both a <LINK_DIRECTORIES> and a <LINK_ONLY_LIBRARIES> is
necessary, because dmc can't deal with the directory paths being on
the command line.

Amitha.
William A. Hoffman
2006-05-19 15:09:30 UTC
Permalink
Post by Amitha Perera
Post by William A. Hoffman
I am not even sure we always have that information. For example,
someone might do LINK_DIRECTORIES(....) LINK_LIBRARIES(A).
In principle, CMake has enough knowledge to look for it by scanning
the current LINK_DIRECTORIES for libA.
Sure, cmake would have to be a linker.... Or at least act like one...
Post by Amitha Perera
Post by William A. Hoffman
Maybe we could set the LIB env as part of the link command.
SET(CMAKE_LIBRARY_PATH_FLAG ";")
SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
"set LIB=<LINK_LIBRARIES>"
"link ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out:<TARGET> /PDB:<TARGET_PDB> /dll <LINK_FLAGS> <OBJECTS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
I tried this before my previous post, and it didn't work. The problem
is that the directory still appears on the command line, and it is
interpreted as a library.
Post by William A. Hoffman
We might need to create a <LINK_DIRECTORIES> that would only have
the link directories part of the link line, but that might work with
the extra junk at the end of the lib path.
I think both a <LINK_DIRECTORIES> and a <LINK_ONLY_LIBRARIES> is
necessary, because dmc can't deal with the directory paths being on
the command line.
Yea, I think that is what is needed.

The other option is to use the Microsoft linker....

-Bill
William A. Hoffman
2006-05-19 16:11:25 UTC
Permalink
Post by William A. Hoffman
Yea, I think that is what is needed.
The other option is to use the Microsoft linker....
I have another idea. Write a small program or .bat file
to run the link command and add the -L ability to it.
It would basically setenv LIB to the parsed out -L path options,
then call the DM linker. It should be pretty easy to write
a small c++ program that uses the cmake libraries. DMLinkerFix.exe.

-Bill
Amitha Perera
2006-05-31 20:42:41 UTC
Permalink
Post by William A. Hoffman
I have another idea. Write a small program or .bat file
to run the link command and add the -L ability to it.
It would basically setenv LIB to the parsed out -L path options,
then call the DM linker.
I did this using a small perl script to wrap around the linker, and I
managed to get things working using NMake as the make program (so I
didn't need to write a generator).

However, I'm having a lot of pain compiling vxl with it (which was my
original intent). My current reaction is that Digital Mars is not
complete enough to make vxl work easily, so I'm dropping the issue for
now.

That said, I think I did manage to resolve the CMake-Digital Mars
interface, so if someone feels the urge to see what I did to get that
done, I can describe it in more detail.

Cheers,
Amitha.
Cesar Rabak
2006-05-20 15:29:32 UTC
Permalink
OK, another 0.01999... to your idea:

DM has a utility called 'cl.exe' (look for it in the BIN directory) which emulates a lot of Microsoft command line compiler and linker.

Have a try w/it!
Post by William A. Hoffman
Yea, I think that is what is needed.
The other option is to use the Microsoft linker....
I have another idea. Write a small program or .bat file
to run the link command and add the -L ability to it.
It would basically setenv LIB to the parsed out -L path options,
then call the DM linker. It should be pretty easy to write
a small c++ program that uses the cmake libraries. DMLinkerFix.exe.

-Bill

_______________________________________________
CMake mailing list
***@cmake.org
http://www.cmake.org/mailman/listinfo/cmake
--
Cesar Rabak
GNU/Linux User 52247.
Get counted: http://counter.li.org/

---------------------------------
Yahoo! Messenger com voz - Instale agora e faça ligações de graça.
James Mansion
2006-05-31 22:06:51 UTC
Permalink
Do you actually need to add -L?

I think if you have:

link a.obj c:\foo bar.lib

(and c:\foo is a directory)

then it will look for bar.lib in c:\foo.

Haven't tried myself, but recently I recall seeing the thread started here:
http://www.digitalmars.com/drn-bin/wwwnews?c%2B%2B.command-line/639
link <link flags> <objects>,<exename>,<mapfile>,lib1 lib2 \my\lib\path\
lib3 lib4 lib5,<def file>,<res file>
-----Original Message-----
From: cmake-bounces+james=***@cmake.org
[mailto:cmake-bounces+james=***@cmake.org]On Behalf Of
Amitha Perera
Sent: 31 May 2006 21:43
To: William A. Hoffman
Cc: ***@cmake.org
Subject: Re: [CMake] Digital Mars
I have another idea. Write a small program or .bat file
to run the link command and add the -L ability to it.
It would basically setenv LIB to the parsed out -L path options,
then call the DM linker.
I did this using a small perl script to wrap around the linker, and I
managed to get things working using NMake as the make program (so I
didn't need to write a generator).

However, I'm having a lot of pain compiling vxl with it (which was my
original intent). My current reaction is that Digital Mars is not
complete enough to make vxl work easily, so I'm dropping the issue for
now.

That said, I think I did manage to resolve the CMake-Digital Mars
interface, so if someone feels the urge to see what I did to get that
done, I can describe it in more detail.

Cheers,
Amitha.

Loading...