I am working on a project consisting of several small executables. Executable files are intended to be launched from the terminal (or command line) and can be written in any programming language. In interpreted languages, the shebang string is for unixy systems, while their file extension is added to the Windows PATHEXT environment variable.
In order for the use of executable files to be consistent across all programming languages ββand both major platform groups, I need to remove the file extension from the file name of the interpreted programs on unixy systems. (By "sequential use" I mean: just enter the name of the program to run it without specifying its file extension.)
To get to the specific, suppose I'm writing something like the following CMakeLists file:
project (Mixed Example) add_executable (banana banana.cpp) add_executable (grape grape.hs) add_script? (orange orange.py) add_script? (strawberry strawberry.lua) install (TARGETS banana grape orange strawberry DESTINATION bin)
Then I want banana.cpp and grape.hs be compiled in the usual way, while I want the orange.py and strawberry.lua file extensions to be separated conditionally, depending on the platform. Thus, the bin directory should contain the following files on a unixy system:
banana grape orange strawberry
and on Windows:
banana.exe grape.exe orange.py strawberry.lua
How to do it?
build cmake
Julian
source share