Is there anyway to execute a set command via a batch file, at compile time to establish the paths needed for the compile to run. This would be executed just before the compile takes place via the compile command line.
Thanks.
Adding Path at Compile Time
This should be very easy to do using a batch file and the compiler command line of the document type.
All you need todo is to create a batch file to set up the required environment variables and to run the compiler. This batch file can then be used as the compiler command line of the document type.
As a simple example consider the following compiler batch file. Save the code below to the c:\temp\cc.cmd batch file:
Next, open a file call c:\temp\test.cpp file and use the Compile Options menu to bring up the compiler options for this document type.
Notice how the name of the document type is displayed in the caption of the options dialog. The document type is associated to the file extension so you can have as many document types (and hence as many different compiler configurations) as there are file extensions.
In the compiler command line section of this c/c++ document type add this text for the command line and apply the changes:
With the c:\temp\test.cpp file (or any other cpp file) as the active file, hit the compile toolbar button or compile menu item and you should see the compiler output window displayed, containing the following text:
Cheers Jussi
All you need todo is to create a batch file to set up the required environment variables and to run the compiler. This batch file can then be used as the compiler command line of the document type.
As a simple example consider the following compiler batch file. Save the code below to the c:\temp\cc.cmd batch file:
Code: Select all
@echo off
rem Example command line: c:\temp\cc.cmd "$fn" "these are the options" $fb $ext
set zeus_test_variable = "this is an environment variable"
echo . Example Batch Compile
echo . =====================
echo .
echo . Below is the description of the batch file arguments:
echo .
echo . The file being compiled is: %1 (argument #1)
echo . The options passed in where: %2 (argument #2)
echo . The file base name was: %3 (argument #3)
echo . The file extension was: %4 (argument #4)
echo .
echo . This line outputs the word Error to show how they are highlighted in red.
echo .
echo . This line outputs the word Warning to show how they are highlighted in green.
echo .
echo . Here is the envioronment variable:
set zeus_test_variable
Notice how the name of the document type is displayed in the caption of the options dialog. The document type is associated to the file extension so you can have as many document types (and hence as many different compiler configurations) as there are file extensions.
In the compiler command line section of this c/c++ document type add this text for the command line and apply the changes:
Code: Select all
c:\temp\cc.cmd "$fn" "these are the options" $fb $ext
Code: Select all
Debug: Changed to the 'c:\temp\' directory supplied
Debug: Command: c:\temp\cc.cmd "c:\temp\test.cpp" "these are the options" test .cpp
--------------------Configuration: Calculate - Debug--------------------
Using document type compiler options....
Debug: Command Line: D:\WINNT\system32\cmd.exe /c c:\temp\cc.cmd "c:\temp\test.cpp" "these are the options" test .cpp
Debug: Started Process ID: 0x1AC
. Example Batch Compile
. =====================
.
. Below is the description of the batch file arguments:
.
. The file being compiled is: "c:\temp\test.cpp" (argument #1)
. The options passed in where: "these are the options" (argument #2)
. The file base name was: test (argument #3)
. The file extension was: .cpp (argument #4)
.
. This line outputs the word Error to show how they are highlighted in red.
.
. This line outputs the word Warning to show how they are highlighted in green.