if it wouldn't be legal there's plenty of other assorted reasons you can put to an contract termination which are very broad/general and usually very hard to get around.
I live in the netherlands, here 's legal , but still people usually just keep it a secret from their employers. i generally don't, but this does affect how my work and my attitude is judged by others. any miss or fail is generally blamed on pot, while if i wouldn't tell them, it will just be blamed on something else... ^^
if you intent to keep smoking weed, just accept that a lot of people (employers) will think that it makes you less fit mentally and physically for work, and they will use it as a blanket excuse for everything they want to critisize you for. just show them your care face, work hard, and prove to them they are ill informed. :)